Skip to main content

Fast libuv + picohttpparser WSGI/ASGI server (Irish: freastal — service)

Project description

freastal

A fast WSGI/ASGI server for Python, built as a C extension on top of libuv and picohttpparser. Optional TLS 1.3 via picotls.

Freastal (IPA: /ˈfʲɾʲasˠtəl/) is Irish Gaelic for "service."

Performance

Benchmarked against gunicorn+uvicorn (the most common production Python stack) as baseline. 30-second runs, wrk -t4 -c40, 4 worker processes, ARM64 Linux.

500B response

Server Protocol Req/s p50 p99 vs baseline
gunicorn+uvicorn ASGI ~225k 156µs 476µs 1.00×
bjoern WSGI ~370k 90µs 390µs 1.65×
freastal WSGI ~424k 78µs 312µs 1.88×
freastal ASGI ~408k 81µs 317µs 1.81×
freastal TLS 1.3 ~421k 78µs 342µs 1.87×

12KB response

Server Protocol Req/s p50 p99 vs baseline
gunicorn+uvicorn ASGI ~201k 173µs 524µs 1.00×
bjoern WSGI ~293k 120µs 360µs 1.46×
freastal WSGI ~299k 114µs 391µs 1.49×
freastal ASGI ~295k 115µs 409µs 1.47×
freastal TLS 1.3 ~279k 121µs 555µs 1.39×

Installation

Pre-built wheels for Linux (x86_64, aarch64) and macOS (arm64, x86_64) are available on PyPI:

pip install freastal

Building from source requires libuv ≥ 1.44, a C compiler, and (optionally) OpenSSL for TLS support. See Building from source.

Usage

WSGI

import freastal

def app(environ, start_response):
    body = b"Hello, world!"
    start_response("200 OK", [("Content-Type", "text/plain")])
    return [body]

freastal.serve(app, host="0.0.0.0", port=8000, workers=4)

ASGI

import freastal

async def app(scope, receive, send):
    await send({"type": "http.response.start", "status": 200,
                "headers": [[b"content-type", b"text/plain"]]})
    await send({"type": "http.response.body", "body": b"Hello, world!"})

freastal.serve_asgi(app, host="0.0.0.0", port=8000, workers=4)

TLS 1.3

freastal.serve(app, host="0.0.0.0", port=8000, workers=4,
               certfile="/path/to/cert.pem", keyfile="/path/to/key.pem")

TLS requires OpenSSL headers at build time. Wheels published to PyPI include TLS support.

Architecture

  • libuv — cross-platform event loop; io_uring-ready on Linux (libuv ≥ 1.45 batches syscalls automatically)
  • picohttpparser — SSE4.2/NEON SIMD HTTP/1.1 parser from the h2o project; vendored
  • picotls — TLS 1.3 library from the h2o project; vendored, gated by FREASTAL_TLS
  • io_uring fixed-buffer path (Linux, optional) — when built with liburing, responses > 4 KB are copied into pre-registered kernel buffers and sent with io_uring_prep_write_fixed, eliminating per-write get_user_pages() overhead. libuv ≥ 1.45 also transparently batches accept/read/write via io_uring regardless of this flag.
  • Single uv_write per response — headers and body sent together, no extra copy
  • HTTP/1.1 keep-alive: connections re-armed in-place without close/reopen; TCP_NODELAY set on every accepted socket
  • Slab allocator for per-connection state — no per-request malloc on the hot path
  • Pre-interned Python strings for all WSGI/ASGI environ keys
  • GIL released for the duration of the libuv event loop; acquired only when calling the WSGI/ASGI application and touching Python response objects
  • SO_REUSEPORT (UV_TCP_REUSEPORT) for kernel-level load balancing across worker processes

Multi-process model: workers=N forks N independent OS processes, each with its own libuv loop and Python interpreter (and therefore its own GIL). The kernel distributes incoming connections across workers via SO_REUSEPORT.

ASGI event loop bridge (libuv ↔ asyncio):

freastal runs asyncio inside the libuv event loop rather than the other way around. A uv_check_t steps asyncio after each I/O poll; a uv_poll_t on asyncio's selector fd wakes libuv when external async I/O (database calls, aiohttp, etc.) completes.

Building from source

# macOS
brew install libuv openssl@3
pip install freastal --no-binary freastal

# Debian/Ubuntu
apt-get install libuv1-dev libssl-dev
pip install freastal --no-binary freastal

# Debian/Ubuntu with io_uring fixed-buffer path (Linux ≥ 5.6)
apt-get install libuv1-dev libssl-dev liburing-dev
pip install freastal --no-binary freastal

picohttpparser and picotls are vendored — no extra steps required.

Requirements

  • Python ≥ 3.10
  • Linux or macOS
  • libuv ≥ 1.44 (shared library, found via pkg-config or standard include paths)
  • OpenSSL (optional, for TLS 1.3)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freastal-0.0.1.tar.gz (108.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

freastal-0.0.1-cp313-cp313-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

freastal-0.0.1-cp313-cp313-manylinux_2_28_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

freastal-0.0.1-cp313-cp313-macosx_15_0_x86_64.whl (121.6 kB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

freastal-0.0.1-cp313-cp313-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

freastal-0.0.1-cp312-cp312-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

freastal-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

freastal-0.0.1-cp312-cp312-macosx_15_0_x86_64.whl (121.6 kB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

freastal-0.0.1-cp312-cp312-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

freastal-0.0.1-cp311-cp311-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

freastal-0.0.1-cp311-cp311-manylinux_2_28_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

freastal-0.0.1-cp311-cp311-macosx_15_0_x86_64.whl (121.4 kB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

freastal-0.0.1-cp311-cp311-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

freastal-0.0.1-cp310-cp310-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

freastal-0.0.1-cp310-cp310-manylinux_2_28_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

freastal-0.0.1-cp310-cp310-macosx_15_0_x86_64.whl (121.6 kB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

freastal-0.0.1-cp310-cp310-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file freastal-0.0.1.tar.gz.

File metadata

  • Download URL: freastal-0.0.1.tar.gz
  • Upload date:
  • Size: 108.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for freastal-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4b368271dd514025fd6ffaec83a61d1cb8b5bd6a9d9e874f53c87c3d82301253
MD5 bbc5974f39f704b18f654af1d72a1167
BLAKE2b-256 308aa3d34b80442989a773523e5d2aa960699b15341bb58c37a4025e9289e108

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1.tar.gz:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a80efd1ee12dab39f0d689e34bf94b32f6e3cdf8cac292b632416f7a57141387
MD5 38b1c24b6974bf3617a2554c48a2aff0
BLAKE2b-256 b4d90f8a2fe085fac03e9936c9701fe7e8142f231005773436faa67c54933262

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 272104fe856ce7b425eba918a319e5ba8b7e7260043aa086233a390cdb38067b
MD5 ba53178b5edfc1478df49f8c6175a3bf
BLAKE2b-256 3c72b7dac82f6b8fa5efe4f07a00245475aa79404416e1a8fca71cf97bde4915

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 0b62fc3dc4c59994d98c0de53c0897426d34f2ecb31227c84e91495c7e057a4d
MD5 19a6e410859d5a15d86675f0295af71e
BLAKE2b-256 c8c99a5a90901da9d045313562bce4215bc34994d854089e19b28b179432c74a

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp313-cp313-macosx_15_0_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b9d312a4e30a4805fb2b7ead26d2f6a4f12edd84a06cc8703d73dd8dfff059f0
MD5 2da4c7c2982d13cc62530e0eda56c038
BLAKE2b-256 da645eaac0373419a81e334592f0105e061fe7dee2f076789d890ed5c0f5a6b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4fc9d84b8956ea097797ece5b77392681385b98143d54798444e3f9a97e1fcd6
MD5 09e19213d0462417dbb3644d5fe5e826
BLAKE2b-256 12c64953ea675664b7c430750072203cf4c8f0035cfed7d16bf25bacdd3bd971

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c126b7553543d1d78bc9de5f8c1fe7a0ef2210d656674debb01b7c56f981e3f9
MD5 54237786a0ab3c327c2370b1d045bc09
BLAKE2b-256 8f08f048fcf2a41484c7bf1a8f31082310d2c26a8bb305aae1e1800d71853ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 823db3c64faa12589e9b0585de558a0f33301fbd942dbc778ba5f36b5fe89030
MD5 04e0a56009d94899b5a58daa8aea12cf
BLAKE2b-256 8e4dd896c474332e627bbcb23bce6a3c9db6d141b7bb28f41015540f52226f8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp312-cp312-macosx_15_0_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2480e60db56291ed204df92ab48ed8bd632d7602ca5493fdfc5f0d84e26ff8f6
MD5 74254e5521b50597410b9bac9b61cb0d
BLAKE2b-256 9c81781f679b165978abad7f439ce5fdc1f28c4bac2fdef40ca436f23e334fe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f391730d800165a853cbd27f0bd0324fc450ccab9db9f1b1e9584230585c1c11
MD5 048470cd0c70c34522259d117161806b
BLAKE2b-256 abc59177f317219d0f45cc84e31c3036e480dbf49ec53298d59d5d14ed9c01b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 790c484f2fe26aec51d0582b5927e5500438fddbdb3e5ed570c2e9f718548e26
MD5 73f0fec497ad482236cd9edbdecae313
BLAKE2b-256 5a4c6035146e14c83099c10a0d7f879afa7f29819c78f26f1e9e80b5e617b8df

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp311-cp311-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 29c24c247ac6abb97008a5f543c04fa9249c658b7ee78ce17a67f11c8aa93e5f
MD5 48da27fb66978927c8fa5b0b45967692
BLAKE2b-256 f22c17e6bac0364fa8eb314280e7f9a9c0b766a2310bd73333831e80306187c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp311-cp311-macosx_15_0_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7caa01eabac50195378fdf6c129a112f7305c532ef7f40b72ea55ae83cdb28ac
MD5 4c9206ad6391905b847f4c7423e65a0d
BLAKE2b-256 fc012b3cc3800fec5101b890b9c4f9ae27997f94367b7c14540534eb42281e8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0acb80606a737555bef9b3b25df7ddc3ac882116b037fe5c68c8fb5fd3b4cf13
MD5 67a27acb29b4bc918c2facfd9b57d81a
BLAKE2b-256 623369f3c0373bc90bd54916c50dc8caa9a1ba9798dbcb455088e5ca558a4da2

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2adbaed8c3683260f64024b224a92bf60ba2ffaf39f1ee049050d30eb122cae9
MD5 b9b60bf3eef9b7e0b9ce5d5ebd55171d
BLAKE2b-256 07a387053cbc310061f28d0d6daf24b0e4b04b6da51f8b115e3426dde5dda449

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp310-cp310-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp310-cp310-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 343bd366f88d5654f83c097fe9db6f6429ade09485c1563c07891a8c351e725b
MD5 8fba6fb8785093fb286da6c4ab86acc6
BLAKE2b-256 a962ba71deab8ced7d9e3490ff70b98d9c3b1cd260a3dc1b65bec4df4c194512

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp310-cp310-macosx_15_0_x86_64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freastal-0.0.1-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.1-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 657427b8fe56c8bf2e28cd9ab49452f8430c2e9971badd1eb83c237c16665a9e
MD5 5d558f44af2ea4badd1862143c11e10c
BLAKE2b-256 7d9b0cccc9acca861121d6702b85160cca7d974e0023e17f974283b126ac36d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.1-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: publish.yml on jbylund/freastal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page