🚀Debugging Microservices & Distributed Systems

Trevor I. Lasn

Staff Software Engineer & Engineering Manager

Updated on
20 min read
advanced

Who is the fastest? Node.js, Bun.js, or Deno.js

A detailed comparison of Node.js, Bun.js, and Deno.js runtime performance

Speed isn’t the only factor that makes a JavaScript runtime great, but it’s a good place to start.

A runtime is essentially the environment that executes your code, handling things like memory management, i/o operations, and more.

A runtime is the engine under the hood of your JavaScript applications.

RuntimeEngineEngine Language (Built in)Runtime Language (Built In)First Release
Node.jsV8C++C++2009
DenoV8C++Rust2020
BunJavaScriptCoreC++Zig2022

The terms “engine” and “runtime” refer to different components that work together to execute JavaScript code.

Engine

The engine is the core component that interprets or compiles JavaScript code into machine code that the computer can execute. It is responsible for understanding and executing the JavaScript syntax and features.

Engines are designed to optimize code execution and manage memory efficiently.

  • V8: An open-source JavaScript engine developed by Google, written in C++. It’s used in both Node.js and Deno, as well as in Google Chrome.
  • JavaScriptCore: Also known as “JSC,” this is the engine developed by Apple, written in C++, and used in Bun and Safari.

Runtime

The runtime is the environment that provides additional functionality beyond what the engine offers. That includes APIs and libraries that enable interactions with the operating system, manage i/o operations, handle asynchronous tasks, and more.

The runtime essentially wraps around the engine and extends its capabilities.

  • Node.js: Built in C++ and JavaScript, it provides a rich set of APIs for server-side development, such as file system access, HTTP servers, and more.
  • Deno.js: Developed in Rust, Deno offers secure-by-default features, native TypeScript support, and a standard library.
  • Bun.js: Written in Zig, Bun focuses on performance and includes a fast JavaScript/TypeScript runtime and bundler.

How They Work Together

Engine + Runtime: The engine parses and executes the JavaScript code, while the runtime provides the necessary environment and tools for the code to interact with the system and perform useful tasks.

For example, in Node.js, the V8 engine handles the JavaScript execution, while the Node.js runtime provides modules like fs (for file system operations) and http (for building servers).

Similarly, in Deno, the V8 engine runs the JavaScript, and the Deno runtime offers features like permissions and a standard library for common tasks.

Bun uses JavaScriptCore for execution and its runtime for high-performance utilities.

In a nutshell, the engine is the core JavaScript interpreter or compiler. The runtime is the broader environment that includes tools, libraries, and APIs for building and running applications.

Both are essential for the complete execution of JavaScript code in different contexts.

Importance of Speed in JavaScript Runtimes

  1. User Experience: Faster response times result in a better user experience. Applications that run quickly are seen as more responsive and reliable. This can increase user satisfaction and retention.

  2. Scalability: Higher speed often correlates with lower resource usage. This efficiency enables servers to handle more concurrent users or requests, enhancing scalability and cost-effectiveness, particularly for high-traffic applications.

  3. Developer Productivity: Faster runtimes shorten development time by speeding up testing and debugging phases. Quicker feedback loops enhance the developer experience and accelerate the development process.

  4. Cost Efficiency: Efficient resource utilization lowers operational costs. By reducing CPU and memory usage, you can achieve significant savings, especially as your application scales.

Benchmarking Runtimes Using AutoCannon

AutoCannon is an HTTP/1.1 benchmarking tool. It excels at assessing the performance of HTTP/1.1 servers by focusing on key metrics like raw throughput and latency.

I simulated 100 concurrent connections for 30 seconds. I measured how well each runtime handles requests and data under heavy load.

Hardware Overview

Terminal window
Hardware:
Model Name: MacBook Pro (2023)
Model Identifier: Mac15,7
Chip: Apple M3 Pro
Total Number of Cores: 12 (6 performance and 6 efficiency)
Memory: 36 GB
System Firmware Version: 10151.140.19
OS Loader Version: 10151.140.19
macOS (Sonoma): 14.6 (23G80)

Key Metrics

  1. Requests per Second (Req/Sec): Indicates the number of HTTP requests the server can handle per second. A higher value means better handling of concurrent traffic.
  2. Average Latency: Measures the time taken for a request to travel to the server and back. Lower latency means faster response times.
  3. Throughput: Represents the amount of data transferred between the server and clients per second. Higher throughput indicates the server’s efficiency in handling data.

Understanding the Metrics (example)

The table below provides a snapshot of the key performance metrics observed during our benchmarking tests. Each metric helps illustrate how well the servers perform under load, offering insights into their responsiveness and capacity.

Metric2.5%50%97.5%99%AvgStdevMax
Latency (ms)00110.10.3419
Req/Sec100,479100,479106,367108,607106,182.41,948.84100,454
Bytes/Sec (MB)18.518.519.62019.535718.5

Breakdown of Metrics

  • Percentiles (2.5%, 50%, 97.5%, 99%): These values show the latency experienced by the top percentages of requests. For example, the 2.5% value means 2.5% of the requests had a latency equal to or lower than that number, highlighting the best response times. The 50% (median) indicates the typical latency, while 97.5% and 99% values show the upper range of latencies, reflecting slower responses under load.

  • Avg (Average): This represents the mean value of all data points, such as latency or request rate. It provides a general sense of the runtime’s performance, showing how quickly the server responds on average.

  • Stdev (Standard Deviation): This metric measures the variability in the data points. A low standard deviation suggests consistent performance, while a high standard deviation indicates more variability and potential instability.

  • Max: The maximum observed value, representing the worst-case scenario. It shows the highest latency or the most substantial deviation from the average performance, crucial for understanding the extremes of system performance.

These metrics provide a clear picture of each server’s efficiency in handling concurrent requests and data. They allow us to assess the stability, speed, and overall reliability of the runtimes.

Node.js (v22.5.1)

Terminal window
benchmark node -v
v22.5.1
benchmark npm run bench:autocannon:node
> [email protected] bench:autocannon:node
> autocannon -c 100 -d 30 http://localhost:3000
Running 30s test @ http://localhost:3000
100 connections
┌─────────┬──────┬──────┬───────┬──────┬────────┬─────────┬───────┐
Stat 2.5% 50% 97.5% 99% Avg Stdev Max
├─────────┼──────┼──────┼───────┼──────┼────────┼─────────┼───────┤
Latency 0 ms 0 ms 1 ms 1 ms 0.1 ms 0.34 ms 19 ms
└─────────┴──────┴──────┴───────┴──────┴────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬───────────┬──────────┬─────────┐
Stat 1% 2.5% 50% 97.5% Avg Stdev Min
├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤
Req/Sec 100,479 100,479 106,367 108,607 106,182.4 1,948.84 100,454
├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤
Bytes/Sec 18.5 MB 18.5 MB 19.6 MB 20 MB 19.5 MB 357 kB 18.5 MB
└───────────┴─────────┴─────────┴─────────┴─────────┴───────────┴──────────┴─────────┘
Req/Bytes counts sampled once per second.
# of samples: 30
3186k requests in 30.01s, 586 MB read
Metric2.5%50%97.5%99%AvgStdevMax
Latency (ms)00110.10.3419
Req/Sec100,479100,479106,367108,607106,182.41,948.84100,454
Bytes/Sec (MB)18.518.519.62019.535718.5

Node.js handled an average of 106,182.4 requests per second with an average latency of 0.1 ms. The maximum latency reached was 19 ms, indicating some variability under load but generally low. The throughput was 586 MB.

Bun.js (v1.1.21)

Terminal window
benchmark bun -v
1.1.21
benchmark npm run bench:autocannon:bun
> [email protected] bench:autocannon:bun
> autocannon -c 100 -d 30 http://localhost:3001
Running 30s test @ http://localhost:3001
100 connections
┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
Stat 2.5% 50% 97.5% 99% Avg Stdev Max
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
Latency 0 ms 0 ms 0 ms 1 ms 0.02 ms 0.16 ms 16 ms
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬────────────┬──────────┬─────────┐
Stat 1% 2.5% 50% 97.5% Avg Stdev Min
├───────────┼─────────┼─────────┼─────────┼─────────┼────────────┼──────────┼─────────┤
Req/Sec 128,639 128,639 132,095 135,423 132,417.07 1,567.99 128,591
├───────────┼─────────┼─────────┼─────────┼─────────┼────────────┼──────────┼─────────┤
Bytes/Sec 16.5 MB 16.5 MB 16.9 MB 17.3 MB 16.9 MB 201 kB 16.5 MB
└───────────┴─────────┴─────────┴─────────┴─────────┴────────────┴──────────┴─────────┘
Req/Bytes counts sampled once per second.
# of samples: 30
3973k requests in 30.01s, 508 MB read
Metric2.5%50%97.5%99%AvgStdevMax
Latency (ms)00010.020.1616
Req/Sec128,639128,639132,095135,423132,417.071,567.99128,591
Bytes/Sec (MB)16.516.516.917.316.920116.5

Bun.js showed 132,417.07 requests per second with an impressive average latency of just 0.02 ms. The maximum latency observed was 16 ms. Bun.js also had a throughput of 508 MB, slightly lower than Node.js.

Deno (v1.45.5)

Terminal window
benchmark deno --version
deno 1.45.5 (release, aarch64-apple-darwin)
v8 12.7.224.13
typescript 5.5.2
benchmark npm run bench:autocannon:deno
> [email protected] bench:autocannon:deno
> autocannon -c 100 -d 30 http://localhost:8000
Running 30s test @ http://localhost:8000
100 connections
┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
Stat 2.5% 50% 97.5% 99% Avg Stdev Max
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
Latency 0 ms 0 ms 1 ms 1 ms 0.04 ms 0.23 ms 20 ms
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬────────────┬──────────┬─────────┐
Stat 1% 2.5% 50% 97.5% Avg Stdev Min
├───────────┼─────────┼─────────┼─────────┼─────────┼────────────┼──────────┼─────────┤
Req/Sec 141,439 141,439 148,991 149,887 148,309.34 1,748.84 141,387
├───────────┼─────────┼─────────┼─────────┼─────────┼────────────┼──────────┼─────────┤
Bytes/Sec 21.8 MB 21.8 MB 23 MB 23.1 MB 22.8 MB 271 kB 21.8 MB
└───────────┴─────────┴─────────┴─────────┴─────────┴────────────┴──────────┴─────────┘
Req/Bytes counts sampled once per second.
# of samples: 30
4449k requests in 30.01s, 685 MB read
Metric2.5%50%97.5%99%AvgStdevMax
Latency (ms)00110.040.2320
Req/Sec141,439141,439148,991149,887148,309.341,748.84141,387
Bytes/Sec (MB)21.821.82323.122.827121.8

Deno led the pack with 148,309.34 requests per second and an average latency of 0.04 ms. The maximum latency reached 20 ms, showing good consistency. Deno achieved the highest throughput among the three, at 685 MB.

Results

Latency: Lower latency means faster response times. Bun.js and Deno had lower average latencies compared to Node.js, making them more responsive under the same load.

Requests per Second: This metric indicates how many requests the server can handle per second. Deno outperformed both Node.js and Bun.js, making it the most capable in handling large numbers of concurrent requests.

Throughput: Throughput measures the amount of data processed per second. Deno also excelled here, handling the highest amount of data.

Conclusion

Deno stood out as the fastest among the three, followed by Bun.js, with Node.js coming in third.

Benchmarking Runtimes Using Artillery

Artillery is designed for sophisticated load testing, including testing APIs, microservices, and websites. It’s used for simulating complex, real-world scenarios with multiple stages and user interactions.

Node.js

Terminal window
benchmark node -v
v22.5.1
benchmark npm run bench:artillery:node
> [email protected] bench:artillery:node
> artillery run artillery.yaml
Test run id: tnkrx_az9b76npmdxe6byqfzm48bepakc7d_h7p6
Phase started: unnamed (index: 0, duration: 60s) 20:15:29(+0300)
--------------------------------------
Metrics for period to: 20:15:30(+0300) (width: 0.521s)
--------------------------------------
http.codes.200: ................................................................ 57
http.downloaded_bytes: ......................................................... 912
http.request_rate: ............................................................. 57/sec
http.requests: ................................................................. 57
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.2
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 57
vusers.completed: .............................................................. 19
vusers.created: ................................................................ 19
vusers.created_by_name.0: ...................................................... 19
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 2.9
max: ......................................................................... 17.6
mean: ........................................................................ 8.5
median: ...................................................................... 11.8
p95: ......................................................................... 13.3
p99: ......................................................................... 13.3
--------------------------------------
Metrics for period to: 20:15:40(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 24000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 12
mean: ........................................................................ 2.1
median: ...................................................................... 2
p95: ......................................................................... 2.7
p99: ......................................................................... 4.3
--------------------------------------
Metrics for period to: 20:15:50(+0300) (width: 9.958s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 24000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 4.8
mean: ........................................................................ 1.8
median: ...................................................................... 1.8
p95: ......................................................................... 2.1
p99: ......................................................................... 2.5
--------------------------------------
Metrics for period to: 20:16:00(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 24000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 4.9
mean: ........................................................................ 1.7
median: ...................................................................... 1.7
p95: ......................................................................... 2
p99: ......................................................................... 2.3
--------------------------------------
Metrics for period to: 20:16:10(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 24000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 3.7
mean: ........................................................................ 1.7
median: ...................................................................... 1.6
p95: ......................................................................... 2.1
p99: ......................................................................... 2.6
--------------------------------------
Metrics for period to: 20:16:20(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 24000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 15
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 15.7
mean: ........................................................................ 1.7
median: ...................................................................... 1.6
p95: ......................................................................... 2
p99: ......................................................................... 5.6
Phase completed: unnamed (index: 0, duration: 60s) 20:16:29(+0300)
--------------------------------------
Metrics for period to: 20:16:30(+0300) (width: 9.759s)
--------------------------------------
http.codes.200: ................................................................ 1443
http.downloaded_bytes: ......................................................... 23088
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1443
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1443
vusers.completed: .............................................................. 481
vusers.created: ................................................................ 481
vusers.created_by_name.0: ...................................................... 481
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 8.2
mean: ........................................................................ 1.6
median: ...................................................................... 1.6
p95: ......................................................................... 1.9
p99: ......................................................................... 2.9
All VUs finished. Total time: 1 minute, 3 seconds
--------------------------------
Summary report @ 20:16:32(+0300)
--------------------------------
http.codes.200: ................................................................ 9000
http.downloaded_bytes: ......................................................... 144000
http.request_rate: ............................................................. 140/sec
http.requests: ................................................................. 9000
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 15
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 9000
vusers.completed: .............................................................. 3000
vusers.created: ................................................................ 3000
vusers.created_by_name.0: ...................................................... 3000
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 17.6
mean: ........................................................................ 1.8
median: ...................................................................... 1.7
p95: ......................................................................... 2.3
p99: ......................................................................... 4.4

Deno.js

Terminal window
benchmark deno --version
deno 1.45.5 (release, aarch64-apple-darwin)
v8 12.7.224.13
typescript 5.5.2
benchmark npm run bench:artillery:deno
> [email protected] bench:artillery:deno
> artillery run artillery.yaml
Test run id: tcge5_ycwyfxjqxr67qbz353wmw8qyxkmpr_tgwh
Phase started: unnamed (index: 0, duration: 60s) 20:41:23(+0300)
--------------------------------------
Metrics for period to: 20:41:30(+0300) (width: 6.606s)
--------------------------------------
http.codes.200: ................................................................ 972
http.downloaded_bytes: ......................................................... 14580
http.request_rate: ............................................................. 154/sec
http.requests: ................................................................. 972
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 972
vusers.completed: .............................................................. 324
vusers.created: ................................................................ 324
vusers.created_by_name.0: ...................................................... 324
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.5
max: ......................................................................... 20.4
mean: ........................................................................ 2.5
median: ...................................................................... 2
p95: ......................................................................... 4.4
p99: ......................................................................... 13.1
--------------------------------------
Metrics for period to: 20:41:40(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 22500
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 2
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 14.7
mean: ........................................................................ 2
median: ...................................................................... 1.9
p95: ......................................................................... 2.7
p99: ......................................................................... 4.7
--------------------------------------
Metrics for period to: 20:41:50(+0300) (width: 9.956s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 22500
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 2
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 3.6
mean: ........................................................................ 1.9
median: ...................................................................... 1.8
p95: ......................................................................... 2.3
p99: ......................................................................... 2.9
--------------------------------------
Metrics for period to: 20:42:00(+0300) (width: 9.958s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 22500
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 7
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 19.3
mean: ........................................................................ 1.8
median: ...................................................................... 1.7
p95: ......................................................................... 2.2
p99: ......................................................................... 3.2
--------------------------------------
Metrics for period to: 20:42:10(+0300) (width: 9.957s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 22500
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 8
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 10.5
mean: ........................................................................ 1.8
median: ...................................................................... 1.7
p95: ......................................................................... 2.1
p99: ......................................................................... 4.4
Phase completed: unnamed (index: 0, duration: 60s) 20:42:23(+0300)
--------------------------------------
Metrics for period to: 20:42:20(+0300) (width: 9.956s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 22500
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 9
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 11.3
mean: ........................................................................ 1.7
median: ...................................................................... 1.6
p95: ......................................................................... 1.9
p99: ......................................................................... 2.3
--------------------------------------
Metrics for period to: 20:42:30(+0300) (width: 3.66s)
--------------------------------------
http.codes.200: ................................................................ 528
http.downloaded_bytes: ......................................................... 7920
http.request_rate: ............................................................. 161/sec
http.requests: ................................................................. 528
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 528
vusers.completed: .............................................................. 176
vusers.created: ................................................................ 176
vusers.created_by_name.0: ...................................................... 176
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 2.3
mean: ........................................................................ 1.6
median: ...................................................................... 1.6
p95: ......................................................................... 2.1
p99: ......................................................................... 2.2
All VUs finished. Total time: 1 minute, 3 seconds
--------------------------------
Summary report @ 20:42:26(+0300)
--------------------------------
http.codes.200: ................................................................ 9000
http.downloaded_bytes: ......................................................... 135000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 9000
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 9
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 9000
vusers.completed: .............................................................. 3000
vusers.created: ................................................................ 3000
vusers.created_by_name.0: ...................................................... 3000
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 20.4
mean: ........................................................................ 1.9
median: ...................................................................... 1.7
p95: ......................................................................... 2.4
p99: ......................................................................... 4.9

Bun.js

Terminal window
benchmark bun -v
1.1.21
benchmark npm run bench:artillery:bun
> [email protected] bench:artillery:bun
> artillery run artillery.yaml
Test run id: txg9b_bhhmharkmpc6g57bxp5zqmm854rcb_dq49
Phase started: unnamed (index: 0, duration: 60s) 20:44:33(+0300)
--------------------------------------
Metrics for period to: 20:44:40(+0300) (width: 6.208s)
--------------------------------------
http.codes.200: ................................................................ 909
http.downloaded_bytes: ......................................................... 10908
http.request_rate: ............................................................. 160/sec
http.requests: ................................................................. 910
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 2
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 909
vusers.completed: .............................................................. 303
vusers.created: ................................................................ 304
vusers.created_by_name.0: ...................................................... 304
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 18.4
mean: ........................................................................ 2.5
median: ...................................................................... 2
p95: ......................................................................... 4.2
p99: ......................................................................... 13.1
--------------------------------------
Metrics for period to: 20:44:50(+0300) (width: 9.999s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 18000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.3
max: ......................................................................... 9.9
mean: ........................................................................ 1.9
median: ...................................................................... 1.8
p95: ......................................................................... 2.5
p99: ......................................................................... 3.1
--------------------------------------
Metrics for period to: 20:45:00(+0300) (width: 9.999s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 18000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 8.2
mean: ........................................................................ 1.9
median: ...................................................................... 1.8
p95: ......................................................................... 2.4
p99: ......................................................................... 3.2
--------------------------------------
Metrics for period to: 20:45:10(+0300) (width: 9.999s)
--------------------------------------
http.codes.200: ................................................................ 1501
http.downloaded_bytes: ......................................................... 18012
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 13
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1501
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 15
mean: ........................................................................ 1.8
median: ...................................................................... 1.7
p95: ......................................................................... 2.2
p99: ......................................................................... 2.9
--------------------------------------
Metrics for period to: 20:45:20(+0300) (width: 9.999s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 18000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 4
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.2
max: ......................................................................... 11.6
mean: ........................................................................ 1.7
median: ...................................................................... 1.6
p95: ......................................................................... 2.1
p99: ......................................................................... 5.5
Phase completed: unnamed (index: 0, duration: 60s) 20:45:33(+0300)
--------------------------------------
Metrics for period to: 20:45:30(+0300) (width: 9.999s)
--------------------------------------
http.codes.200: ................................................................ 1500
http.downloaded_bytes: ......................................................... 18000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 1500
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 1
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 1500
vusers.completed: .............................................................. 500
vusers.created: ................................................................ 500
vusers.created_by_name.0: ...................................................... 500
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1.1
max: ......................................................................... 8.5
mean: ........................................................................ 1.7
median: ...................................................................... 1.6
p95: ......................................................................... 2.1
p99: ......................................................................... 3
--------------------------------------
Metrics for period to: 20:45:40(+0300) (width: 4.103s)
--------------------------------------
http.codes.200: ................................................................ 590
http.downloaded_bytes: ......................................................... 7080
http.request_rate: ............................................................. 161/sec
http.requests: ................................................................. 590
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 2
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 590
vusers.completed: .............................................................. 197
vusers.created: ................................................................ 196
vusers.created_by_name.0: ...................................................... 196
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1
max: ......................................................................... 7.2
mean: ........................................................................ 2
median: ...................................................................... 1.7
p95: ......................................................................... 4.2
p99: ......................................................................... 6.4
All VUs finished. Total time: 1 minute, 3 seconds
--------------------------------
Summary report @ 20:45:36(+0300)
--------------------------------
http.codes.200: ................................................................ 9000
http.downloaded_bytes: ......................................................... 108000
http.request_rate: ............................................................. 150/sec
http.requests: ................................................................. 9000
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 13
mean: ........................................................................ 0.1
median: ...................................................................... 0
p95: ......................................................................... 1
p99: ......................................................................... 1
http.responses: ................................................................ 9000
vusers.completed: .............................................................. 3000
vusers.created: ................................................................ 3000
vusers.created_by_name.0: ...................................................... 3000
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 1
max: ......................................................................... 18.4
mean: ........................................................................ 1.9
median: ...................................................................... 1.7
p95: ......................................................................... 2.5
p99: ......................................................................... 5

Breakdown Of Metrics

  • HTTP Codes: The number of successful HTTP responses (200 OK) received.
  • Downloaded Bytes: The total amount of data downloaded during the test.
  • Request Rate: The number of HTTP requests sent per second.
  • Response Time: The time taken for a server to respond to a request, including metrics like min, max, mean, median, p95 * (95th percentile), and p99 (99th percentile).
  • Virtual Users (VUs): The number of simulated users interacting with the server, including those completed, created, failed, and their session lengths.

Results

In the Artillery benchmark tests, we evaluated Node.js, Deno, and Bun.js by simulating real-world scenarios with a significant number of virtual users (VUs).

Node.js:

  1. HTTP Codes 200: Successfully handled 9000 requests.
  2. Request Rate: Maintained an average of 140 requests per second.
  3. Response Time: The mean response time was low at 0.1 ms, with a maximum of 15 ms.
  4. Virtual Users Completed: 3000 VUs completed their sessions, with session lengths ranging from 1.1 to 17.6 seconds.

Deno.js:

  1. HTTP Codes 200: Handled 9000 successful responses.
  2. Request Rate: Averaged around 150 requests per second.
  3. Response Time: Consistently low response times, with a mean of 0.1 ms and a maximum of 9 ms.
  4. Virtual Users Completed: 3000 VUs completed their sessions, with session lengths between 1.1 and 20.4 seconds.

Bun.js:

  1. HTTP Codes 200: Also handled 9000 requests successfully.
  2. Request Rate: Similar to Deno, with 150 requests per second.
  3. Response Time: Very low mean response time of 0.1 ms, with a maximum of 13 ms.
  4. Virtual Users Completed: 3000 VUs completed their sessions, with session lengths from 1 to 18.4 seconds.

Overall, all three runtimes handled high concurrent traffic excellently with minimal response times.

Deno and Bun.js had slightly higher request rates than Node.js.

All three maintained low response times, showing efficient performance under load.

The consistent handling of 3000 virtual users across all tests demonstrates the stability and reliability of each runtime in real-world scenarios.

Final Conclusion

Based on the benchmarks, Deno appears to be the fastest runtime. It consistently demonstrated the highest request rates, lowest response times, and handled the largest amount of data throughput.

While Deno excels in raw performance, the choice of runtime should also consider factors like ecosystem maturity, community support, and ease of use.

However, it’s important to note that software is constantly evolving with updates and optimizations. The performance differences are slight, making it a difficult decision.

Each runtime has its strengths, and the best choice depends on your specific project requirements and context.


Recommended Engineering Resources

Here are engineering resources I've personally vetted and use. They focus on skills you'll actually need to build and scale real projects - the kind of experience that gets you hired or promoted.

Imagine where you would be in two years if you actually took the time to learn every day. A little effort consistently adds up, shaping your skills, opening doors, and building the career you envision. Start now, and future you will thank you.


This article was originally published on https://www.trevorlasn.com/blog/benchmarks-for-node-bun-deno. It was written by a human and polished using grammar tools for clarity.

Interested in a partnership? Shoot me an email at hi [at] trevorlasn.com with all relevant information.