Skip to main content

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

uwsgi-readiness-check-0.2.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

uwsgi_readiness_check-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file uwsgi-readiness-check-0.2.0.tar.gz.

File metadata

  • Download URL: uwsgi-readiness-check-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for uwsgi-readiness-check-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b8c4bfba260ec6f1937ca8d8968f2415aba82428637da17653fc04a3378d752e
MD5 97e3fffe40c1efdfa5dcf9fbf28a1fbc
BLAKE2b-256 76722d3f1d0c3f3352c944775554acc6a73fe5dd76cf055dd86e54769a96e97a

See more details on using hashes here.

File details

Details for the file uwsgi_readiness_check-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uwsgi_readiness_check-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for uwsgi_readiness_check-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7a2b5a94407193bc876efd28157a45833cb69c372f7684004fa729eca2f1ab0
MD5 bc750aadac87b5ca2c4e33e0474d0d11
BLAKE2b-256 161947272b4e8331dcb07db058fc36d36122ea023d328706969d8a83df38a99d

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