Rinha de Backend 2024/Q1 · Python pressure lab

Slow is Smooth.
Smooth is Fast.

A Flask/Gunicorn/PostgreSQL implementation tuned for a banking API challenge: two Python APIs, one NGINX edge, PostgreSQL atomic procedures, and a 1.5 CPU / 550MB envelope.

  • Python 3.14
  • Flask 3.1
  • Gunicorn
  • PostgreSQL procedures
  • NGINX
  • k6 CI
LanguagePython 3.14
APIFlask + Gunicorn
DatabasePostgreSQL procedures
EdgeNGINX least_conn
Load testk6 reports
source-backed constraints

The whole stack fits inside the contest envelope.

class ChallengeEnvelope:
    # Rinha de Backend 2024/Q1
    TOTAL_CPU = 1.5
    TOTAL_RAM_MB = 550

    # Request path
    EDGE = "NGINX"
    API_REPLICAS = 2
    API_RUNTIME = "Flask + Gunicorn"
    DATABASE = "PostgreSQL procedures"

    # Validation
    STRESS_TOOL = "k6"
    REPORTS_ARCHIVED = 33

implementation mechanisms

Not async theater. A measured WSGI and Postgres path.

PostgreSQL 16.7 · psycopg2 pool

Atomic database path

Business rules live in PostgreSQL stored procedures so debits, credits, limits, and balances resolve inside one transactional boundary.

4 workers × 2 threads per API

Two WSGI API replicas

The Python service runs as two Flask/Gunicorn containers behind NGINX, tuned for the challenge CPU and memory split.

Release artifacts · report archive

Constraint-first validation

The site links directly to committed k6 HTML reports and the release workflow artifacts so performance claims stay tied to evidence.

benchmark dossier

Numbers stay attached to run artifacts.

k6 reports are published as static artifacts. Treat these values as historical proof points, then open the reports to inspect the exact run output before making performance decisions.

47k+successful requestsHistorical target tracked by k6 reports
33archived stress runsStatic HTML reports published with the site
1.5 / 550CPU cores / MB RAMFull-stack resource envelope

latest artifact

2026-04-01 · 07:36 UTC

Open the newest archived k6 HTML report, then compare it with the workflow that generated it.