Deno vs. Node.js vs Bun: Performance (Latency - Throughput - Saturation - Availability)

Anton Putra
18 Oct 202412:28

Summary

TLDRThis video benchmarks the performance of Deno v2, Bun, and Node.js in a Kubernetes environment, focusing on key metrics like latency, throughput, CPU usage, memory usage, and error rates. The first test evaluates application performance under load, revealing that Bun excels in CPU efficiency, while Deno demonstrates lower latency when not overloaded. The second test, involving a PostgreSQL database, highlights Deno's slower performance attributed to database requests. Overall, the video offers valuable insights for developers looking to optimize application performance in production settings.

Takeaways

  • 😀 Deno v2, Bun, and Node.js were tested for performance in Kubernetes, focusing on latency, throughput, service saturation, and errors.
  • 📊 The first test measured latency using the p99 percentile and throughput in requests per second.
  • ⚙️ All applications were deployed in a production-ready AWS EKS cluster with large instance types to generate load.
  • 📉 Deno demonstrated lower latency than Node.js initially, but its performance declined at higher loads, peaking at 80,000 requests per second.
  • 💻 Bun was the most CPU-efficient application, while Node.js struggled under heavy load, reaching a breaking point at 50,000 requests per second.
  • 🧠 Memory usage was capped at 256 MB, with Bun showing stable performance compared to Deno and Node.js.
  • 📈 In the second test involving PostgreSQL, Deno had the highest latency primarily due to database interactions.
  • 🔄 All applications handled similar request volumes, indicating that the database was a performance bottleneck.
  • 🧩 Connection pooling was effectively implemented, with a maximum of 40 connections per instance, enhancing overall performance.
  • 🔍 The findings suggest Deno is suitable for latency-sensitive applications, while Bun excels in high-throughput scenarios.

Q & A

  • What are the four golden signals measured in the performance comparison of Deno, Bun, and Node.js?

    -The four golden signals are latency, throughput, service saturation (CPU and memory usage), and errors (availability).

  • How is latency measured in the tests conducted?

    -Latency is measured from the client side using the p99 percentile.

  • What was the breaking point for each application in terms of requests per second?

    -Bun reached around 88,000 requests per second, Deno around 80,000, and Node.js only managed 50,000 requests per second.

  • What impact does Kubernetes throttling have on application performance?

    -Kubernetes throttling can lead to significant degradation in performance, as it limits the CPU resources available to the application.

  • Which application showed the highest CPU efficiency during the tests?

    -Bun demonstrated the highest CPU efficiency, followed by Deno, with Node.js being the least efficient.

  • What unique issue was identified with Bun during the second test involving Postgres?

    -Bun exhibited CPU and latency spikes, suggesting a potential bug in how it parses JSON payloads or generates UUIDs, especially under low load.

  • In the second test, which application had the lowest overall latency?

    -Node.js had the lowest overall latency, while Deno had the highest latency mainly due to database requests.

  • How were the clients deployed to generate load in the tests?

    -The clients were deployed using a Kubernetes Job, creating 20 pods for each application to generate load, eventually increasing to around 4,000 virtual clients.

  • What optimization tool was used for Postgres in the tests?

    -pgtune was used to optimize Postgres for the hardware used in the tests.

  • What can developers infer about using Deno versus Bun for client-facing applications?

    -Developers may prefer Deno for applications where low latency is critical, while Bun may be more suitable for applications that require handling large workloads.

Outlines

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Mindmap

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Keywords

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Highlights

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Transcripts

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora
Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
Performance BenchmarkKubernetesDenoBunNode.jsDatabase LatencyCPU UsageAWS EKSMicroservicesWeb Development
¿Necesitas un resumen en inglés?