Fully Loaded Node – A Node.JS Holiday Season, part 2
Node.js runs JavaScript on a single core, so CPU-heavy work needs special handling to keep a server responsive. Mozilla Persona's team judged five designs against four goals: saturating all cores, staying responsive, degrading gracefully under overload and integrating simply. Running work on the main thread, wrapping it in a fake-async API, using threaded native libraries (capped by Node's 4-thread internal pool, which also starves I/O) and the cluster module all fall short. Their compute-cluster library runs dedicated worker processes behind an async API, tracks queue depth and average job time, and rejects requests up front when the predicted wait exceeds a client-supplied max_request_time.
Related posts
- Node.js at scale, rebalanced: how we cut cost by 38%
Booking.com Engineering mediumAdeptBooking.com cut compute costs for its largest Node.js React SSR service by 38% (30% fewer pods, 20% less memory per pod, up to 10% lower tail latency) without touching service code, by moving from pm2's cluster-based processes to wattpm worker threads and revisiting long-untouched configuration. Synthetic k6 tests showed 20-50% more throughput within latency SLOs, validated through a side-by-side production A/B split at the routing layer. Production exposed uneven worker load because SO_REUSEPORT's connection hashing interacted badly with nginx loopback connections recycled via tcp_tw_reuse. Giving each worker its own port and load-balancing in nginx fixed it, which also opened the door to smarter balancing between heavy renders and light metadata requests.
- Node.js and the tale of worker threads
Zalando Engineering mediumAdeptA Node.js service using cluster mode called os.cpus().length inside a Kubernetes container, which returns the host's core count, not the pod's CPU allocation. On a 48-core node it forked 48 processes inside a 2GB pod. Each needed about 120MB, so the processes were killed under memory pressure and immediately re-forked by the exit handler, flooding a translation service with startup requests (1,000 to 20,000 rpm) and causing cancelled connections and read timeouts. The initial diagnosis of a retry feedback loop caused by process.exit() on fetch failure turned out to be wrong. The fix was to drop cluster mode and let Kubernetes handle scaling, and the incident motivated adding event-loop lag and other signals through an internal Node.js observability SDK.
- Bun v1.1.25
Bun mediumAdept
Bun v1.1.25 adds node:cluster support, which lets a pool of workers share one port via reusePort for multi-core HTTP throughput. Load balancing only works as expected on Linux. It also adds an initial V8 C++ API compatibility layer implemented on top of JavaScriptCore, needed because the two engines differ in GC and handle-scope semantics, so native packages like cpu-features now load. The release also enables the OMGJIT WebAssembly JIT on Windows (about 20% faster on a hashing benchmark), makes @aws-sdk/client-s3 uploads 5x faster via a node:http client fix, and lets standalone executables bundle Workers and embedded files through Bun.embeddedFiles. A batch of Node.js compatibility and crash fixes rounds it out.
- Server rendering benchmarks: Railway vs Cloudflare vs Vercel
Railway mediumAdeptRunning Theo Browne's SSR benchmark suite (400 requests, 20 concurrent connections, from an EC2 client in us-west-1) against Railway with 10 replicas, Cloudflare Workers and Vercel Functions gave mixed results. Railway won SvelteKit and Vanilla JS by roughly 3-4×, React SSR was close, and Vercel and Cloudflare led on Next.js and the math workload. Bun beat Node on Railway for most tests but lost on math. Next.js is limited to a single CPU core, so it only scales horizontally. Node also builds V8 without a faster trig-function path that Workers enables, and container runtimes cost about 40% versus native, a gap Railway expects a new VM runtime to close.
- Keep the monolith, but split the workloads
incident.io mediumAdeptA Go monolith can get much of the reliability isolation of microservices by splitting workloads into separate deployments of the same binary, instead of breaking it into services. After a bad Pub/Sub message caused an unhandled panic that crashed the web, worker and cron threads together for 32 minutes, incident.io split them into independent Heroku dyno tiers selected by command-line flags. They also gave each class of work its own capped Postgres connection pool and statement timeout, so low-priority jobs such as BigQuery event export or best-effort nudges fall behind rather than exhausting the shared database. The main migration hazard is code that assumes a shared process, such as process-local caches, and the fix is to move that coordination into Postgres or Redis.