ysskrishna logoysskrishna

Express FastAPI Performance Test

FastAPI vs Express: Performance Benchmark with Artillery

Gallery image 1
Gallery image 2
Gallery image 3

Artillery load tests across FastAPI (sync), FastAPI (async), and Express, with capped CPU/RAM

This repository compares three API implementations (FastAPI synchronous, FastAPI asynchronous, and Express) against a shared PostgreSQL schema. Docker Compose profiles run one backend at a time; each service is constrained (as documented) to half a CPU core and 512 MB RAM so runs are more comparable. Artillery YAML suites cover read-heavy, write-heavy, spike, stress, soak, and breakpoint read/write patterns, with scripts to produce JSON and HTML reports.

When it is useful

You want repeatable numbers for talks, internal RFCs, or classroom exercises, not a single “winner” claim for every workload. The README also links a Looker Studio dashboard and ships example Artillery outputs for reference.

What you can do

  • Start a profile (fastapi-sync, fastapi-async, or express) and run run_artillery_test.sh with a scenario name from the docs.
  • Sweep all profiles and scenarios with run_all_artillery_tests.sh when you need a full matrix.
  • Inspect generated reports locally or compare against the bundled documentation snapshots; the README also points to an example Looker Studio dashboard at https://lookerstudio.google.com/reporting/270e16b6-8831-41d5-aed0-4d2352b39218/page/pqwOF.

Limits

  • Results bind tightly to hardware, Docker limits, DB tuning, and Artillery config; your production stack will differ.
  • Fairness still depends on equivalent app logic, connection pooling, and warm-up; interpret deltas carefully.
  • This project benchmarks; it does not choose your framework for you without your own product constraints.

Frequently asked questions

What backends are compared?

Three API implementations against a shared PostgreSQL schema: FastAPI synchronous, FastAPI asynchronous, and Express. Docker Compose profiles run one backend at a time with each service capped at 0.5 CPU and 512 MB RAM.

Which Artillery scenarios are included?

YAML suites cover read-heavy, write-heavy, spike, stress, soak, breakpoint-read, and breakpoint-write. Scripts emit JSON and HTML reports under artillery_tests/reports/.

How do I run a test?

Install Artillery 2.0.21 (and the metrics-by-endpoint plugin), then run ./run_artillery_test.sh <profile> <test-type>, for example fastapi-async read-heavy. Use ./run_all_artillery_tests.sh for the full matrix.

Where can I see example results?

The README links a Looker Studio dashboard and ships example Artillery outputs under documentation/. Results still bind to your hardware, Docker limits, DB tuning, and Artillery config.

Continue exploring

ProductExpress FastAPI Protobuf

Express FastAPI Protobuf

Reference architecture for Vue.js, Express, and FastAPI using Protocol Buffers for efficient binary serialization
Backend & APIs
Starter Kits & Boilerplates
Vue
Express
ProductExpress Multi-Tenant Configurations

Express Multi-Tenant Configurations

Multi-tenancy boilerplate with Node.js, Express & Prisma
Databases & SQL
Backend & APIs
Experimental Projects
Node.js
BlogCover image for How Microservices Verify JWTs Without Calling the Auth Service

How Microservices Verify JWTs Without Calling the Auth Service

Auth & Security
Backend & APIs
+1
8 min read
ProductEmail Audit Rules Engine

Email Audit Rules Engine

Audits email quality and compliance with a rules engine.
Experimental Projects
Python
Docker
Bash
ProductEasy Calculator

Easy Calculator

React-based calculator with a clean, responsive design.
Experimental Projects
JavaScript
React
ProductFastapi Sync Async Starter Template

Fastapi Sync Async Starter Template

Free FastAPI Poetry template with SQLAlchemy 2.0 sync (psycopg2) and async (asyncpg) Postgres, Redis rate limits, pytest coverage, and Docker Compose.
Backend & APIs
Starter Kits & Boilerplates
FastAPI
PostgreSQL