Back to articles
Technology Insight

Scaling to 80k RPS: Optimizing a Node.js REST API on a 1 vCPU VPS with Bun and ElysiaJS

May 30, 2026

The Challenge: Modern API Demands on Minimal Infrastructure

In contemporary backend engineering, maximizing resource efficiency is no longer just a cost-saving measure; it is a competitive advantage. Monolithic architectures and traditional runtime environments often struggle under heavy traffic, requiring early vertical or horizontal scaling. For many enterprises, the immediate reaction to performance degradation is provisioning more expensive cloud infrastructure. However, optimization at the runtime and framework layer can yield exponential gains without increasing infrastructure spend.

This case study explores an architectural migration from a standard Node.js and Express REST API to Bun and ElysiaJS. The goal was simple yet ambitious: push a modest, single-core virtual private server (1 vCPU VPS with 2GB RAM) to its absolute physical limits. By swapping the underlying runtime and leveraging a framework optimized for the modern web, we achieved a milestone of 80,000 requests per second (RPS) while maintaining predictable, single-digit millisecond latency.

---

Analyzing the Bottlenecks of Traditional Node.js Stacks

For nearly a decade, Node.js has been the standard for JavaScript-based backend development. Combined with Express, it powers millions of production APIs. While highly reliable, this traditional stack introduces significant overhead under extreme concurrent loads:

  • V8 Runtime Overhead: While highly optimized, the V8 engine requires substantial startup time and memory overhead compared to modern alternatives.
  • Event Loop Lag: High concurrency creates a bottleneck in the Node.js single-threaded event loop, leading to increased response latency as the request queue grows.
  • Express Middleware Chains: Express relies heavily on synchronous middleware execution and deep call stacks, which degrade throughput when handling tens of thousands of simultaneous connections.
"True infrastructure optimization begins when we stop throwing hardware at inefficient software architectures."

To break through the performance ceiling imposed by our 1 vCPU constraints, we needed a runtime designed from the ground up for speed, and a routing framework that minimizes CPU cycle waste.

---

Enter the Modern Stack: Bun and ElysiaJS

The solution lay in two cutting-edge technologies within the JavaScript ecosystem: Bun and ElysiaJS.

Why Bun?

Bun is a fast, all-in-one toolkit for JavaScript and TypeScript applications. Unlike Node.js, Bun is built around the WebKit JavaScriptCore (JSC) engine, which is traditionally optimized for fast startup times and lower memory footprint. Furthermore, Bun is written in Zig, a low-level systems programming language that allows for precise memory management and zero-cost abstractions. Bun natively implements fast HTTP networking using modern system calls like epoll on Linux, vastly outperforming Node.js's standard net module.

Why ElysiaJS?

ElysiaJS is a TypeScript framework designed specifically for Bun. It is renowned for its blazing-fast routing speeds, achieved through Static Code Analysis and dynamic compilation. Elysia compiles your HTTP route handlers into highly optimized JavaScript functions at startup. This means that during runtime, it executes the absolute minimum number of CPU instructions required to parse a request and return a response, making it uniquely suited for resource-constrained environments like a 1 vCPU VPS.

---

The Benchmarking Environment and Migration Strategy

To ensure a fair and rigorous comparison, we deployed both implementations to identical server instances and utilized an external benchmarking agent to simulate realistic, heavy user traffic.

### Server Specifications
  • Processor: 1 vCPU (AMD EPYC, shared)
  • Memory: 2 GB RAM
  • Operating System: Ubuntu 24.04 LTS
  • Network: 1 Gbps port
### The Code Evolution

The migration process was remarkably straightforward due to Elysia's intuitive syntax and Bun's native compatibility with existing Node.js modules. Below is a structural comparison of how the API endpoints evolved during the transition.

The original Express implementation relied on standard JSON serialization and manual asynchronous handling:

const express = require('express');
const app = express();

app.get('/api/v1/health', (req, res) => {
  res.json({ status: 'ok', timestamp: Date.now() });
});

app.listen(3000);

The migrated ElysiaJS implementation utilized strict TypeScript and benefited from automatic schema validation and compilation optimization:

import { Elysia } from 'elysia';

const app = new Elysia()
  .get('/api/v1/health', () => ({
    status: 'ok',
    timestamp: Date.now()
  }))
  .listen(3000);
---

The Results: Breaking the 80k RPS Barrier

Load testing was conducted using wrk, a highly efficient HTTP benchmarking tool, executing from an isolated client machine within the same data center region to eliminate internet latency variables.

Metric Node.js + Express Bun + ElysiaJS Improvement Factor
Peak Throughput 12,500 RPS 81,200 RPS ~6.5x Increase
P99 Latency 124 ms 4.2 ms 29.5x Lower
CPU Utilization 100% (Saturated) 92% (Stable) Optimized Efficiency
Memory Footprint 180 MB 45 MB 4x Lower

The empirical data demonstrates a definitive performance leap. While the Node.js application saturated the single vCPU at just over 12,000 requests per second, the Bun and ElysiaJS ecosystem handled over 81,000 requests per second comfortably. More impressively, the P99 latency dropped drastically from 124ms to under 5ms, ensuring a highly responsive user experience even under peak stress conditions.

---

Key Architectural Takeaways for Enterprise Systems

The success of this optimization project yields several critical insights for technical leadership and system architects:

  1. Maximize Existing Capital: Before approving budget increases for larger cloud instances, evaluate whether the current software stack is artificially bottlenecking the underlying hardware.
  2. Leverage Compiled Routing: Frameworks that utilize static code generation and ahead-of-time (AOT) compiler optimizations like ElysiaJS dramatically reduce CPU cycles per request.
  3. Prepare for the Ecosystem Shift: Bun has matured into a production-ready runtime. Its native support for web standards and TypeScript makes it an enterprise-grade alternative to Node.js for high-throughput microservices.

By transitioning to Bun and ElysiaJS, we successfully transformed a restrictive 1 vCPU VPS into a high-performance backend powerhouse capable of supporting massive concurrent user bases. For organizations looking to optimize infrastructure costs while scaling their digital products, this modern stack presents a highly viable, future-proof architectural blueprint.

Scaling to 80k RPS: Optimizing a Node.js REST API on a 1 vCPU VPS with Bun and ElysiaJS | DPTCloud