Readiness Check for uWSGI
Project description
uwsgi-readiness-check
Readiness check for uwsgi using its stats socket
Use this check to mark a pod running uwsgi
as NotReady
whenever the uwsgi queue crosses a threshold.
This will allow uwsgi to finish processing requests in its queue before Kubernetes sends more traffic to it
Local Development / Testing
Because the readiness check needs to run as part of a pod, in order to have functional test we deploy a small python+uwsgi application that sleeps for a few seconds + a second python "client" script that makes requests. Since the application sleeps upon a request and new requests are constantly being sent, uwsgi will eventually queue and we'll readiness checks should fail.
Kind installation Skaffold installation Kubectl installation
Running locally
With kind
, kubectl
and skaffold
installed, simply run:
skaffold dev
Skaffold builds a docker image, loads into the kind "cluster" and creates the Pods, watches for changes in the filesystem and automatically re-deploys when needed.
Examples:
The example below will prevent traffic from hitting the Pod once the queue reaches 70% its max capacity:
readinessProbe:
exec:
command:
- uwsgi-is-ready
- --stats-socket
- /tmp/uwsgi-stats
- --queue-threshold
- 0.7
failureThreshold: 2
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
You can find a complete example in k8s/deployment.yaml
Installation
In the container image used by your Pod, run:
pip install uwsgi-readiness-check
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
Built Distribution
Hashes for uwsgi-readiness-check-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d42a797f1d662871b49c654936b91d5ca0466c53a4e21a18b46a4e374bde104 |
|
MD5 | 74ed8b66d349df35a70597b4b16955c4 |
|
BLAKE2b-256 | 1700b563cd73168914c2384526d32cd650f0c679cb9daf6b77ae090d796ab132 |
Hashes for uwsgi_readiness_check-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 626ec306dc8754c1b58a079e5ff18db6b2ff8fb791184c4c051a8f22e6590d18 |
|
MD5 | 6c854cf395dc0915d09896c831ddb5df |
|
BLAKE2b-256 | 02c285f6620fad5e2555650b1b74fa62c56be5da680ae3206e8a26a41668228d |