Engineering·Oct 05, 2025·11 min read

Scaling Websockets to 1M Concurrent Agents

How we tuned Node.js, Redis, and our Load Balancers to handle massive real-time streams.

DevOps Team
Engineering team at Bothive. Building the future of AI agent orchestration.

Scaling Websockets to 1 Million

Real-time agent interaction requires Websockets. But standard implementations choke at scale. Here is how we handled the load.

The C10k Problem? Try C1M.

Node.js manages connections well, but the garbage collector pauses were killing us.

Solution 1: uWebSockets.js

We migrated from socket.io to uWebSockets.js. It's written in C++ and binds to Node. The memory footprint dropped by 80%.

Solution 2: Redis Sharding

We use Pub/Sub to sync state across clusters. A single Redis instance became the bottleneck. We moved to Redis Cluster and sharded channels by workspace_id.

Solution 3: Nginx Tuning

We had to increase the open file descriptors limit (ulimit -n) and tune the worker_connections.

nginx
# nginx.conf snippet events { worker_connections 20000; multi_accept on; }

Scaling is hard, but steady.

How to apply this inside Bothive

The practical move is to turn the idea into an agent contract: what the agent can see, what it can do, where it should ask for approval, and how the team will inspect the result. A good Bothive workflow is not just a prompt. It has memory, tools, channels, traces, and a clear boundary between autonomous work and human judgment.

Define the boundary

For engineering work, decide which decisions the agent can make alone and which actions need a teammate in the loop.

Attach real context

Connect docs, customer data, repositories, tickets, calendars, or APIs so the agent works from grounded information.

Ship through a channel

Expose the agent through web chat, API, Slack, WhatsApp, schedules, or internal workflows depending on where the work starts.

Watch the run

Use traces, tool-call history, usage, and failure logs to improve the agent after it meets real users.

01

Build

Turn the idea into a readable agent contract, workflow, or builder graph.

02

Deploy

Run it through Bothive channels, schedules, integrations, and API calls.

03

Observe

Use traces, usage, memory, and tool logs to improve the system over time.

Subscribe to our newsletter

Get the latest updates on AI agent orchestration, product releases, and engineering insights delivered to your inbox.

Scaling Websockets to 1M Concurrent Agents