Rinha de Backend 2024/Q1 · Rust execution lane

Blazingly fast.
Eventually compiled.

A compact Rust banking API built for brutal limits: two Actix workers, one NGINX balancer, PostgreSQL stored procedures, and a full k6 evidence trail.

Rust 1.94 Actix-web 4 SQLx 0.8 PostgreSQL 16

Challenge budget

1.5 CPU and 550MB RAM, fully accounted for.

The homepage now leads with the constraint that makes the implementation interesting: every service earns its share of a tiny resource envelope.

CPU share Memory share
NGINX 0.2 CPU · 20MB
API 1 0.4 CPU · 100MB
API 2 0.4 CPU · 100MB
PostgreSQL 0.5 CPU · 330MB

Runtime topology

NGINX feeds two Rust workers. Postgres owns the transaction law.

Implementation proof

Small surface, hard edges, measurable behavior.

~140 lines in main.rs

single-file API surface

SQLx offline checked

compile-time query cache

UNLOGGED tables

write path tuned for throughput

least_conn NGINX

balances both API workers

Evidence archive

Stress reports stay inspectable.

The archive is treated like audit material: latest run first, every artifact linked, and the CI workflow one step away.