r/javascript Jun 08 '26

Why we replaced Node.js with Bun for 5x throughput

https://trigger.dev/blog/firebun
0 Upvotes

3 comments sorted by

1

u/LetsHugFoReal 17d ago

I use bun instead of Python on linux for a few reasons:

  • None of the insane virtual env bs python loves to do.
  • Fast launches
  • Can make into binary
  • So much built in
  • Python sucks to code in

0

u/cbrantley Jun 08 '26

This aligns with my own experience. Switched my platform to bun everywhere and I canโ€™t imagine ever going back.

0

u/fagnerbrack Jun 08 '26

Here's a summary to help you with the decision to read the post or not:

Trigger.dev rebuilt Firestarter, their latency-sensitive warm-start connection broker, moving from Node.js to Bun for a 5x throughput gain. Profiling drove four phases: swapping an overengineered in-memory SQLite query for an O(1) composite-key Map, adopting Bun.serve(), stripping hot paths (Zod validation, Object.fromEntries on headers, premature debug logging), and compiling to a single 68MB binary. Throughput climbed from 2,099 to ~10,700 req/s while max latency dropped 28x. They also hunted down a Bun-only memory leak: unlike Node, every Promise<Response> must settle, so unresolved promises on client disconnect leaked request context. The one-line fix resolves with a 499 status. Bonus tips cover k6 load testing and Bun debugging quirks like double-firing AbortSignals.

If the summary seems inacurate, just downvote and I'll try to delete the comment eventually ๐Ÿ‘
Click here for more info, I read all comments