Skip to main content

A Python app server based on envoy

Project description

pyvoy

License CI codecov PyPI version

pyvoy is a Python application server implemented in Envoy. It is based on Envoy dynamic modules, embedding a Python interpreter into a module that can be loaded by a stock Envoy binary.

Features

  • ASGI applications
  • WSGI applications with worker threads
  • A complete, battle-tested HTTP stack - it's just Envoy
    • Includes full HTTP protocol support, with HTTP/2 trailers and HTTP/3
  • Any Envoy configuration features such as load shedding can be integrated as normal

Limitations

  • Platforms limited to those supported by Envoy, which generally means glibc-based Linux on amd64/arm64 or MacOS on arm64
  • Multiple worker processes. It is recommended to scale up with a higher-level orchestrator instead and use a health endpoint wired to RSS for automatic restarts if needed
  • Certain non-compliant requests are prevented by Envoy itself
    • The full URL path, including query string, must be ASCII percent-encoded

Installation

pyvoy is published as a wheel that includes both the dynamic module and Envoy itself. You can use it in the same way as any other app server.

uv add pyvoy # or pip install

Running

pyvoy includes a CLI which supports standard options for HTTP servers. If just passing a module:attr name to point to an application, it will be served on plaintext on port 8000.

uv run pyvoy my.module:app

(if the application is named exactly app, :app can be omitted)

To see a full list of options:

uv run pyvoy -h

Benchmarks

We have some preliminary benchmarks just to understand how the approach works specifically for HTTP/2. The main goal is to see if pyvoy runs in the same ballpark as other servers.

A single example from CI for a 10ms service with 10K response size shows:

Running benchmark for pyvoy with protocol=h2 sleep=10ms response_size=10000

Requests      [total, rate, throughput]         13460, 2691.78, 2686.15
Duration      [total, attack, wait]             5.011s, 5s, 10.489ms
Latencies     [min, mean, 50, 90, 95, 99, max]  9.546ms, 11.141ms, 11.066ms, 11.943ms, 12.246ms, 12.997ms, 16.798ms
Bytes In      [total, mean]                     134600000, 10000.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:13460
Error Set:


Running benchmark for granian with protocol=h2 sleep=10ms response_size=10000

Requests      [total, rate, throughput]         13489, 2697.08, 2691.47
Duration      [total, attack, wait]             5.012s, 5.001s, 10.423ms
Latencies     [min, mean, 50, 90, 95, 99, max]  9.253ms, 11.111ms, 11.038ms, 11.883ms, 12.172ms, 12.946ms, 16.373ms
Bytes In      [total, mean]                     134890000, 10000.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:13489
Error Set:

Running benchmark for hypercorn with protocol=h2 sleep=10ms response_size=10000

Requests      [total, rate, throughput]         1002, 183.30, 177.42
Duration      [total, attack, wait]             5.479s, 5.466s, 12.183ms
Latencies     [min, mean, 50, 90, 95, 99, max]  11.43ms, 163.65ms, 13.497ms, 16.099ms, 17.629ms, 5.019s, 5.023s
Bytes In      [total, mean]                     9720000, 9700.60
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           97.01%
Status Codes  [code:count]                      0:30  200:972
Error Set:
Get "http://localhost:8000/controlled": http2: server sent GOAWAY and closed the connection; LastStreamID=2001, ErrCode=NO_ERROR, debug=""

We see that hypercorn seems to not perform well with HTTP/2, with errors and resulting poor performance numbers. We will focus comparisons on granian.

Performance seems to be mostly the same between pyvoy and granian within the range of noise for a fast but still useful in real-world service.

We can try to isolate more performance of the app server itself with a less realistic service with no delay or response.

 Running benchmark for pyvoy with protocol=h2 sleep=0ms response_size=0

Requests      [total, rate, throughput]         104043, 20808.94, 20805.37
Duration      [total, attack, wait]             5.001s, 5s, 856.185µs
Latencies     [min, mean, 50, 90, 95, 99, max]  344.742µs, 1.327ms, 1.294ms, 1.736ms, 1.905ms, 2.271ms, 3.965ms
Bytes In      [total, mean]                     0, 0.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:104043
Error Set:

Running benchmark for granian with protocol=h2 sleep=0ms response_size=0

Requests      [total, rate, throughput]         96513, 19302.87, 19298.03
Duration      [total, attack, wait]             5.001s, 5s, 1.254ms
Latencies     [min, mean, 50, 90, 95, 99, max]  304.289µs, 1.501ms, 1.506ms, 1.827ms, 1.931ms, 2.2ms, 3.776ms
Bytes In      [total, mean]                     0, 0.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:96513
Error Set:

We again see very similar performance likely within the range of noise.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pyvoy-0.1.0-cp314-cp314-manylinux_2_31_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

pyvoy-0.1.0-cp314-cp314-manylinux_2_31_aarch64.whl (28.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

pyvoy-0.1.0-cp314-cp314-macosx_15_0_arm64.whl (32.6 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

pyvoy-0.1.0-cp313-cp313-manylinux_2_31_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ x86-64

pyvoy-0.1.0-cp313-cp313-manylinux_2_31_aarch64.whl (28.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

pyvoy-0.1.0-cp313-cp313-macosx_15_0_arm64.whl (32.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pyvoy-0.1.0-cp312-cp312-manylinux_2_31_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

pyvoy-0.1.0-cp312-cp312-manylinux_2_31_aarch64.whl (28.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

pyvoy-0.1.0-cp312-cp312-macosx_15_0_arm64.whl (32.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pyvoy-0.1.0-cp311-cp311-manylinux_2_31_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

pyvoy-0.1.0-cp311-cp311-manylinux_2_31_aarch64.whl (28.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

pyvoy-0.1.0-cp311-cp311-macosx_15_0_arm64.whl (32.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

pyvoy-0.1.0-cp310-cp310-manylinux_2_31_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

pyvoy-0.1.0-cp310-cp310-manylinux_2_31_aarch64.whl (28.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ ARM64

pyvoy-0.1.0-cp310-cp310-macosx_15_0_arm64.whl (32.6 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file pyvoy-0.1.0-cp314-cp314-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 af6eb90cb0ccca1ff1d28262d1834b700217fc26df59f094cf3f8ec16d0bdedd
MD5 4d70490228f902b7276433d8767af887
BLAKE2b-256 05966de34a4632df7bef172b9475f2cf54189ce681892ee4170e0c2851102870

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp314-cp314-manylinux_2_31_x86_64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp314-cp314-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 4ff21750a094db8e575173252ac3ac8bb6f218d0f2965786a247e7df920e5f61
MD5 db88cd4032d4021095b63d0a55e0c89b
BLAKE2b-256 f9c35b0766cb5c6154590b2f31ef5f8f5f2e96901e3fdc0444f9fcfe648cd154

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp314-cp314-manylinux_2_31_aarch64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4782293b5e6600df0795d677b89df3b1cbc7dc3a25fcd9e953f0882cb21a1ede
MD5 e2f6b46645f55c0716c8fe2882124645
BLAKE2b-256 c366881bd76fd2991814496ff65ca781cd09fc5280b7465d3d386403a968fc8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp314-cp314-macosx_15_0_arm64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp313-cp313-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp313-cp313-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 07e5c6688494699c489574ec41fbdd50b2387e124de69da03a37e82d52a54748
MD5 a165a78f737a9576a3397717682a63bd
BLAKE2b-256 2b6ef768ee852f471ced82ba122427c14a49182ac6b34c137ff6e7e502d8f09e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp313-cp313-manylinux_2_31_x86_64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp313-cp313-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 7607ef2846daf61d33d066d4580d3a65ca5ef99471f11db5eada269ae8d0da75
MD5 885d1bc75ee7c402a7988cf3bcc8acd1
BLAKE2b-256 bd6a69e146a9974e050b3bf77e3c30dec77af08c024bab374a0b0b8fbe5d1101

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp313-cp313-manylinux_2_31_aarch64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5e7450dee4d2c24590afcb045464230c344fd43eedc56f201c361fb64924378c
MD5 b5c3ca6ce2de4848eb2099bbc7b49131
BLAKE2b-256 af3f6ef5bc8e548de3508bf2540632df2781bd8e1bbffe1e17dbef016c6a2d1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 d6ee96657b955553c1d22439a817d805b06f1254187fafaa51529d72eb57c0bf
MD5 40a9ae47b7027439d4c60fc158ada03c
BLAKE2b-256 897e774451f5269f8d505ab74a9df8ae4757dd01a85c4998f25a27d8058fd72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp312-cp312-manylinux_2_31_x86_64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp312-cp312-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 5eb1d27797481d1bf3e901aa7894e1c340dccc6e9d1a68505ed30fa35f4e049f
MD5 60416d66855adb0bd7260d6a1022cf2b
BLAKE2b-256 505136aeceb3f00b239005ceeebed779d6a3ea42488765fd6000b8f5432c6bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp312-cp312-manylinux_2_31_aarch64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1c6666bcf8c775635007e08b062cfbb7831fc300ae1bfd82f978b1eb0191d78b
MD5 19ea0d5f3c2823b9063c6125da111606
BLAKE2b-256 cf690f91f7d090de98a13c4e2f343f523f3d20599ca5b7996ffe0d1fcf67b131

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 2085eed904f21a81da6c7bf4627facda856a0452b6b37be9df60297e3f978554
MD5 0a991958178889d744813bd3d446eced
BLAKE2b-256 5869df6da1c13c5975cecdc3a94c28ea29af34a5533d6c38d157fb17c660ad22

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp311-cp311-manylinux_2_31_x86_64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp311-cp311-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 d914a807c6dfe0caec9a61533ae1725a6ba32a8e4f5fa57e2345f2d6aee9593e
MD5 ebea39b95eec66a6c5c814866d10e138
BLAKE2b-256 59f8ce06c505a3a8efa705a70e5443b2b6c59847166d96f75adebda40134f480

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp311-cp311-manylinux_2_31_aarch64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1303d3b78b7185cec15bca64f2cd4d98c08b7089e7181cfc9cb4403e3b03989a
MD5 f177f836ad7cc4375652de2809306f89
BLAKE2b-256 ef5fee56e2df92bccca0f90f454d4eb4ea5ba3ba71288955da5191b31425505f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 01ec04da831f9e278804a3c634dc4fd39961b78cd25dc895beb6431ccff551ff
MD5 6ac80007228d86a76842849bd37ee4ee
BLAKE2b-256 0110cf9a8969f7af9f30775b7dba041220bee9bbd082062666167dc94b71451a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp310-cp310-manylinux_2_31_x86_64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp310-cp310-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp310-cp310-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 fb2f844477c953f152e49099388ce195708ba7fdf609e7ea7c0f97998f287f31
MD5 04d5620e2262eb89254e2e991abc44e4
BLAKE2b-256 3d2560a77daf0ab7ff4569e58fb5345e7c2762b9da9017eebaadbb7d6abfec29

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp310-cp310-manylinux_2_31_aarch64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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

File details

Details for the file pyvoy-0.1.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyvoy-0.1.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 31c5ad0d5447a335321aa78d7282eb89372dba3db7ac11db080187ecaacb1db7
MD5 899e7942ed188f24a0f0d9027b741d54
BLAKE2b-256 ec45073176e9ffe94c1f4e4e4404fc9df67613ebd7b6891d5ec907dcf8b5df1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoy-0.1.0-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: release.yaml on curioswitch/pyvoy

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