Performance comparison between Rikta, NestJS, and Fastify.
npm install
npm run benchMeasures framework initialization time from module import to server ready.
npm run bench:startupMeasures single-request latency with no concurrent load.
npm run bench:requestsHigh-concurrency throughput testing using Autocannon.
npm run bench:autocannon| Metric | Rikta vs NestJS | Rikta vs Fastify |
|---|---|---|
| Startup | 🟢 -43% faster | 🟢 -13% faster |
| Throughput | 🟢 +9% faster | 🟡 ~equivalent |
| Latency | 🟢 ~40% faster | 🟡 ~2-5% overhead |
Key Takeaway: Rikta is ~40% faster than NestJS and adds minimal overhead (~2-5%) over vanilla Fastify. This is expected since Rikta uses Fastify as its HTTP engine.
See RESULTS.md for detailed results.
const app = await Rikta.create({
port: 3001,
silent: true, // No console output
logger: false // No Fastify logging
});const app = await NestFactory.create(
AppModule,
new FastifyAdapter({ logger: false })
);const app = Fastify({ logger: false });benchmarks/
├── fixtures/
│ ├── fastify-fixture.ts # Pure Fastify server
│ ├── nestjs-fixture.ts # NestJS server
│ └── rikta-fixture.ts # Rikta server
├── startup.bench.ts # Startup time benchmark
├── request-overhead.bench.ts # Request latency benchmark
├── autocannon.bench.ts # Load testing
├── RESULTS.md # Detailed results
└── QUICK-SUMMARY.md # Summary table
- Fork child process per framework
- Measure time from process start to "ready" message
- Run 5 iterations, take median
- Fresh process each iteration
- Start all frameworks (different ports)
- Warm up with 10 requests each
- Measure 100 sequential requests
- Calculate median latency
- Concurrent connections: 10-100
- Duration: 10 seconds
- Measure requests/second and latency percentiles
- Run on Linux for consistent timing
- Close other applications
- Run multiple times, compare medians
- Use
silent: trueandlogger: false
- Startup: Lower is better. Important for serverless/cold starts.
- Request Latency: Lower is better. Measures framework overhead.
- Throughput: Higher is better. Measures sustained load capacity.
- Optimization Guide - Details on performance optimizations
- Architecture - Framework architecture overview