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.2.tar.gz (108.4 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.2-cp313-cp313-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

freastal-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

freastal-0.0.2-cp313-cp313-macosx_26_0_x86_64.whl (127.3 kB view details)

Uploaded CPython 3.13macOS 26.0+ x86-64

freastal-0.0.2-cp313-cp313-macosx_26_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

freastal-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

freastal-0.0.2-cp312-cp312-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

freastal-0.0.2-cp312-cp312-macosx_26_0_x86_64.whl (127.3 kB view details)

Uploaded CPython 3.12macOS 26.0+ x86-64

freastal-0.0.2-cp312-cp312-macosx_26_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

freastal-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

freastal-0.0.2-cp311-cp311-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

freastal-0.0.2-cp311-cp311-macosx_26_0_x86_64.whl (126.9 kB view details)

Uploaded CPython 3.11macOS 26.0+ x86-64

freastal-0.0.2-cp311-cp311-macosx_26_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

freastal-0.0.2-cp310-cp310-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

freastal-0.0.2-cp310-cp310-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

freastal-0.0.2-cp310-cp310-macosx_26_0_x86_64.whl (127.0 kB view details)

Uploaded CPython 3.10macOS 26.0+ x86-64

freastal-0.0.2-cp310-cp310-macosx_26_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 26.0+ ARM64

File details

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

File metadata

  • Download URL: freastal-0.0.2.tar.gz
  • Upload date:
  • Size: 108.4 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.2.tar.gz
Algorithm Hash digest
SHA256 3d258e65bd350c98cde02ad7af1404355c0cf59a5dffb95c83ed9f8b002f39be
MD5 0bf2c4c145d4e661d97d2c870a3aa9a3
BLAKE2b-256 9855b750c9f65711d94a51e5e011cf3161094ed80b11edccb58ced2df5e753f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2.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.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43fb80ecde1958e8ef6de9197d7b6b97318afc3f25130efc30ee678f1106f716
MD5 16ac8099c6649de8654dc261f57040e9
BLAKE2b-256 b18d130389662624cc2c23263854639123839c378b8b076b2df64a1a53397fbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 720b5e4ed0dc0135d680b15afbf7801ba1fdd021f75b775c5c0dc9bae9320bff
MD5 8fb5ea2188f08b0716cd7f00883f2d19
BLAKE2b-256 09b5bfc005a131cf356661bc086efee3d08375532015fd87f3a7c2dfdda8e186

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp313-cp313-macosx_26_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp313-cp313-macosx_26_0_x86_64.whl
Algorithm Hash digest
SHA256 79653604da388d6798dc328a193fae31e9063430d9a98a3743cb0ca93a9c6e05
MD5 05dfdf24a9a5a53fa575ee1e5636b98f
BLAKE2b-256 65345f40e1dc4106dc09ba7f1c9571c07e137d4738101afe701439bd8921bddf

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp313-cp313-macosx_26_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.2-cp313-cp313-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 578686823f6fbe4395a78434ebdebafbe4ed7501157c42cf0ce401d4437c5f14
MD5 306ea7386f7408cdab06c1aa59a26a52
BLAKE2b-256 530aea7c0af2521d78ea45f3b0316213f5368e1a90a355409791a90326735f27

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp313-cp313-macosx_26_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.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7342f46407c00fff21732fcae0c724d9871a88faef1d230b402dd261c1c6800f
MD5 30b3b870606f5fc75bb19371938db6e0
BLAKE2b-256 2c7dffa1c55790aeb5cda83b39cf90f5c4b5b5526aa4e8f4047461b4b01985e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ff3a66df7f23604f5e96d0e9c645595d8ee644cdbf312d6a52e09f989c509689
MD5 8ff9549eb025a113236ae3a3ccaef23d
BLAKE2b-256 d251623c37cd7b640fead1b4be974776c41039b80f152c5b46422ff1521b1d94

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp312-cp312-macosx_26_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp312-cp312-macosx_26_0_x86_64.whl
Algorithm Hash digest
SHA256 6599eacf1249b5320bf77943e707783e56989c7d46793155aabc7b4f3c113336
MD5 9fb255436d05aaca4db9f0f9babc2582
BLAKE2b-256 d2b558f980f1026380267ef04746a0c36b7cb5873f3206a9efc2cd85c23e20cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp312-cp312-macosx_26_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.2-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 76eeb39ecf746ed2e5fba693244a30f1b760980b8347c4c11314c93e435642ef
MD5 e26039a838f34c379ef703f1fd33e426
BLAKE2b-256 392f62ee87c29120784ea7316cbf87cda0e8be9030a52507ce738f4d5effbc0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp312-cp312-macosx_26_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.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 29ec0e3298c20802ff7ea7fa6246d5f314a7ddb79a658ca73ab368ce37b78d8a
MD5 d46679d1e5758fef1653bd074126f458
BLAKE2b-256 ec7d282f8e5871a858cd236a3cef012d112782bac78b72159db9dcc55fe57eb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7020c98095c37fc1cbed415c51bbf280a15fa8927b27be5b618dd14b0664b453
MD5 f7ca5e00553046c328a393421ef77fa6
BLAKE2b-256 19c56a9c31efa2af21c5f36899741ddf5282efdf77b327dac2297f94f5e5bc65

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp311-cp311-macosx_26_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp311-cp311-macosx_26_0_x86_64.whl
Algorithm Hash digest
SHA256 bf4ace4eeaf5081017692a5a95b9210eb0ce37eb948366e57beee3029af8fa04
MD5 b3f936dff5f9ae2c0bbbc0625fad5195
BLAKE2b-256 92527927eff6e7dcbceefdc942cccc2e5c1b9fd8877053a0a7651d9b19034d3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp311-cp311-macosx_26_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.2-cp311-cp311-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 ff7b6d397cf141b3b486993dfa8209f7dc88003cfca5c4f395d7d69fda33da51
MD5 779d7d020bc5dc717c96f048a85cfeea
BLAKE2b-256 b43ca23da106d69c2de67b53d836a2b6955e22f4c23fa8b22dff497389e1ee22

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp311-cp311-macosx_26_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.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7be3888879e2b443299909499dea80b516a12aa251192a01c73d5e9c684d462c
MD5 f3fbfc78ea78c27de04be92df6d10dbf
BLAKE2b-256 4b977a335b501fd99b5316b15455dff5f1f9d2dc75fd823e3643c1fa10d8024a

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 73012003cd903bb686564a0d30a698de02a03b4db35866712a9e569cb032c778
MD5 7c903c89c08b8f8673f46f41d34275d6
BLAKE2b-256 17398041914c97019f1ffbc39800016d986de1ea059a97eba0f8c130811da49d

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-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.2-cp310-cp310-macosx_26_0_x86_64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp310-cp310-macosx_26_0_x86_64.whl
Algorithm Hash digest
SHA256 2dcff58890ec5f020c175ed166a9336b0ac9549462e590c4a7f3adc9c75593f2
MD5 92e8611b3d96a700559425519bbc11fa
BLAKE2b-256 07b72de15e600eac0baa6a21a71239b8f2654913ea136ad7fed6c64ee2dc54cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp310-cp310-macosx_26_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.2-cp310-cp310-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for freastal-0.0.2-cp310-cp310-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 d4289c1c80eaa74dc63a96182960a8aaffdc1132ddcb1191db8bc8271af9d5ee
MD5 60f67208d979fac076a34f6470e13966
BLAKE2b-256 09679351fd00daa13047eeabaabab13dcbd53795a989cd089049e5add7e0fbcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for freastal-0.0.2-cp310-cp310-macosx_26_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