layer-cake
The layer-cake library is for anyone developing software that involves multithreading, multiprocessing or multihosting, usually with the goal of achieving concurrency. Along the way, it manages to pull off some effective network messaging too. If you are trying to improve the throughput of a request processing system, like a website backend, or just maintain responsiveness in complex scenarios, this library is intended for you.
A few highlights include;
code clarity in a notoriously difficult problem domain,
consistent model for multithreading, multiprocessing and multihosting,
trivial changes to switch between the different concurrency mechanisms,
support for implementation of load sensitive network services,
extensive support for low stress multihosting.
Installation
Layer-cake can be installed from PyPI using pip;
$ cd <project-folder>
$ python3 -m venv .env
$ source .env/bin/activate
$ pip3 install layer-cake
Documentation
The goal of this documentation is to demonstrate the use of the layer-cake library to deliver complex examples of concurrency. It will show how a few pages of concise Python (100 lines over 4 files) can deliver a sophisticated template for a website backend, that operates seamlessly across threads, processes and hosts.
Externally the software offers a standard HTTP interface, while internally it runs a fully asynchronous, event-driven execution environment. Demonstrations include;
creation of a pool of request threads with a single call,
load distribution of requests across the pool,
detection of periods of heavy loading and appropriate client feedback,
switching to a pool of request processes with the addition of a single argument,
switching to a pool of request hosts with around 10 lines of additional code.
The material is arranged as a series of guides. A testing client, capable of replicating the workload of large numbers of clients is included. A few references and background information is also provided.
License
The layer-cake library is released under the MIT License.