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
Language Python 3.14
API Flask + Gunicorn
Database PostgreSQL procedures
Edge NGINX least_conn
Load test k6 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.

CI stress tests · report archive

Constraint-first validation

The site links directly to k6-generated HTML reports and the release workflow so performance claims stay tied to run artifacts.

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 requests Historical target tracked by k6 reports
33 archived stress runs Static HTML reports published with the site
1.5 / 550 CPU cores / MB RAM Full-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.