Skip to main content

Serving with asyncio, multiprocessing, and batching

Project description

mpservice

Utilities for Python concurrency, including

  • Serving with multiprocessing to make full use of multiple cores, and batching to take advantage of vectorized computation if some components of the service have that capability.

    One use case is machine learning model serving, although the code is generic and not restricted to this particular use case.

  • Stream processing, i.e. processing a long, possibly infinite stream of input data, with multiple operators in the pipeline. A main use case is that one or more of the operators is I/O bound (think: calling an external service), hence can benefit from concurrency. Both sync and async interfaces are provided.

The serving and streaming utilities can be combined because a mpservice.mpserver.MPServer instance, while doing heavy-lifting in other processes, acts as an I/O bound operator in the main process. Indeed, mpservice.mpserver.MPServer provides methods stream and async_stream for using the server to process data streams.

A MPServer object could be used either in "embedded" mode or to back a HTTP service. In the latter case, the starlette package is a viable choice for providing async service. A few utilities in mpservice.http_server assist with this use case.

The package also contains some other related utilities.

To install, do pip install mpservice.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

mpservice-0.9.7.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

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

mpservice-0.9.7-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file mpservice-0.9.7.tar.gz.

File metadata

  • Download URL: mpservice-0.9.7.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for mpservice-0.9.7.tar.gz
Algorithm Hash digest
SHA256 8acbf9222f2284e251a2f56192891e3af61c7d864244fe5d292d944cc75e0814
MD5 ff7b36070e8d7e94095f17cf05f18f16
BLAKE2b-256 a07c0c0ec07cbe32be6dd6a9c52c7a2a8c75f9940c4cb6cd47884f76b76a8e73

See more details on using hashes here.

File details

Details for the file mpservice-0.9.7-py3-none-any.whl.

File metadata

  • Download URL: mpservice-0.9.7-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for mpservice-0.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d0934ef713934daf7ffcc314d5dd7c8cf8387cfcdea0eeb3273fa1dc0622f08a
MD5 7a87a69078d577c6f9b2932dc9fe5c71
BLAKE2b-256 ec265b6af60ae77e895fb4d31805058479119d790cbe7d38f03a10de1e14ca4b

See more details on using hashes here.

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