By Sagar Shankaran, Founder of CallSphere
Bun's WebSocket implementation handles 1.2M concurrent connections vs Node's 680K on identical hardware. Where the gap is real, where it isn't, and the production tradeoffs.
Key takeaways
Bun ships uWebSockets in C++ as its default server. Node.js ships JavaScript on top of
net. In synthetic WebSocket benchmarks, that gap is 2–4x. In your real app, it is 5–15%. Both numbers are correct.
flowchart TD
Client[Client] --> Edge[Cloudflare Worker]
Edge -->|WS upgrade| DO[Durable Object]
DO --> AI[(OpenAI Realtime WS)]
AI --> DO
DO --> Client
DO -.hibernation.-> Storage[(Persisted state)]Because Bun's HTTP and WebSocket server is built directly on uWebSockets — the same C++ library that powers many high-end Node deployments via uWebSockets.js. There is no JavaScript object per connection, no V8 closure overhead per send, and the event loop is JavaScriptCore's, which has less GC pressure under sustained throughput than V8.
Concretely, Daniel Lemire's well-known benchmark and 2026 follow-ups show:
These numbers describe the runtime. They do not describe your app, which usually spends 80% of its time in I/O to a database, an LLM provider, or another service. Real-world differences shrink to single-digit percent.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
It matters in three specific cases:
It does not matter for a typical AI agent backend that calls OpenAI on every message. The model latency is 200–800 ms; the runtime gap is noise.
CallSphere runs Node.js + Socket.IO on the Sales Calling and After-hours dashboards because the ecosystem (PM2, OpenTelemetry, the entire Socket.IO room semantics) was already built. We evaluated Bun for the dashboard fan-out and found a 12% latency improvement and 30% memory reduction — real, but not enough to justify the migration cost given Socket.IO's adapter ecosystem.
We do run Bun for two specific services:
Both services contribute to the 90+ tools in the platform. The lesson: pick Bun where the workload is HTTP/WebSocket gateway-shaped, stay on Node where the ecosystem matters.
const server = Bun.serve({
port: 8080,
fetch(req, server) {
if (server.upgrade(req, { data: { sid: crypto.randomUUID() } })) return;
return new Response("upgrade required", { status: 426 });
},
websocket: {
open(ws) { ws.subscribe("calls"); },
message(ws, msg) { server.publish("calls", msg); },
close(ws) { ws.unsubscribe("calls"); },
},
});
console.log(`listening on ${server.port}`);
autocannon plus a custom WebSocket script that mirrors your message shape.uWebSockets.js on Node if you want most of the performance without leaving the ecosystem.Does Bun support all Node WebSocket libraries? Most. ws works. Socket.IO works with caveats. uWebSockets.js is unnecessary because Bun ships uWS natively.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Is Bun's debugging story mature? As of 2026, yes — VS Code, Chrome DevTools, and OpenTelemetry support are stable.
Can I run Bun on AWS Lambda? Yes, via the Bun Lambda layer or container images.
What about long-term stability? Bun 1.x has shipped reliably since 2024. We trust it for stateless gateways; stateful long-running services we still default to Node.
Does Deno fit anywhere? It is competitive with Bun on raw throughput and stricter on permissions. We have not deployed Deno in production but evaluated it for short-running tasks.
CallSphere stitches Bun + Node + Python together across 37 agents and six verticals. Try the 14-day free trial at $149/$499/$1499 or book a demo.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
A clean before/after of agent architecture in 2026. The control loop moved from your framework code into the model's reasoning chain. What that looks like.
Google's May 2026 MCP 1.0 + A2A developers guide is the cleanest protocol picker we have seen. The takeaways, in plain English, with a CallSphere lens.
Workspace Studio puts a Gemini-powered AI agent builder inside Google Workspace. A walkthrough of what it does, who it is for, and where it fits in 2026.
How to actually observe a WebSocket fleet: ping/pong heartbeats, Prometheus metrics that matter, dead-man switches, and the alerts that fire before customers notice.
Gemini 3.1 Ultra ships with a 2-million token context window and full text, image, audio, and video multimodality. What changes and how to build for it.
How the modern agent eval stack actually flows: instrument, trace, dataset, evaluator, score, CI gate. The full pipeline that keeps agents from regressing.
© 2026 CallSphere LLC. All rights reserved.