Skip to main content
← PROBLEMS / SYSTEM-DESIGN
An end-to-end domain learning journey

Design a 100K-Session Real-Time Voice
& Multimodal AI Streaming Agent.

Architect a globally distributed real-time voice and multimodal AI platform supporting 100,000 concurrent full-duplex WebRTC sessions with <300ms p95 mouth-to-ear latency and <150ms barge-in cancellation.
Start the journey7 stages· Last modified Nov 24, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When batching and tail latency compete for accelerator cycles, use Geo-DNS Anycast to regional WebRTC SFU edge POPs, sticky session affinity to stateful GPU Media Worker pods, a shared KV-cache prefix pool, and dual-stream lock-free ring buffers.

TL;DR30-second simplified summary
▾

With 25% active inference duty cycle, 100K sessions require ~900 GPUs across regional clusters co-located within 5ms of WebRTC SFU POPs. Sticky session affinity pins each call to a GPU Media Worker pod gated on stream count and HBM.

Inside each pod, lock-free ingress/egress ring buffers prevent GC jitter and enable O(1) barge-in flushes, while RadixAttention deduplicates 2K-4K token system prompts across streams. Redis turn checkpoints allow the SFU to rebind calls to standby GPUs in <100ms.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Real-Time Voice & Multimodal AI Streaming
Full-duplex voice and multimodal AI streaming pipelines replace turn-based HTTP request-response with sub-300ms WebRTC media streams, continuous VAD turn-detection, speculative token-to-phoneme synthesis, and instant barge-in cancellation.
Full walkthrough · 7 stages
01
foundation

Capacity Math, Latency Budget & Stateful Session Constraints.

Why this matters: Size the 100K-session bandwidth, GPU compute, and strict 300ms end-to-end SLA budget.

At 100,000 concurrent sessions (32 kbps Opus audio + 150 kbps 1 FPS VP8 video per active multimodal stream), aggregate edge ingress/egress reaches ~18 Gbps.

Assuming 25% concurrent active speech/decoding duty cycle (~25,000 active inference streams) and ~30 concurrent streaming sessions per H100/B200 GPU pod (colocated ASR + quantized LLM + streaming TTS), the fleet requires ~850–1,000 GPUs across 4–6 global regions.

STAGE 1 · SIZING & SLA

100K-Session Capacity & 300ms Voice-to-Voice Budget

100K ConcurrentPeerstraffic-profileEdge Network + SFUtransport-budgetVAD/ASR + LLM + TTScompute-budget~900 H100/B200 GPUscapacity-targetStreams to GPU pods

1.Duty Cycle Reality: In two-way dialogue, half the time is listening/silence, letting GPUs multiplex ~30 streams.

2.Zero Cross-Ocean Hop: A single US-to-EU hop adds 90ms RTT, consuming 30% of the entire 300ms SLA.

Sizing for 25% active inference duty cycle across 100K sessions requires ~900 GPUs and a strict 40/60/110/70/20ms latency split.

02
foundation

Geo-DNS Edge Termination & Regional WebRTC SFU POPs.

Why this matters: Terminate DTLS-SRTP media close to users and bridge cleanly into backend GPU clusters.

Clients connect via Geo-DNS / Anycast to the nearest regional WebRTC SFU edge POP (e.g., us-east, eu-central, ap-south), keeping client-to-SFU RTT under 25ms.

The SFU handles ICE/STUN/TURN NAT traversal, packet-loss concealment, and Opus/VP8 RTP demuxing, then forwards raw media frames over a persistent, multiplexed gRPC/WebRTC-DataChannel or QUIC backbone tunnel to the regional GPU Media Worker cluster.

STAGE 2 · EDGE INGRESS

Geo-DNS Routing & Regional WebRTC SFU Edge POPs

Geo-DNS / Anycastglobal-routerSFU Edge POP(US/EU/AP)edge-sfuQUIC / gRPCBackbonebackbone-linkRegional GPUClusterinference-zoneDemuxes Opus + keyframes

1.Edge NAT Shield: SFU POPs absorb ICE restarts and cellular IP handoffs without disrupting GPU pods.

2.Regional Co-location: Place GPU inference clusters in the same metro as SFU POPs (<5ms backbone RTT).

Geo-DNS routes users to regional SFU POPs that terminate WebRTC/TURN and stream frames over a <5ms backbone to GPU pods.

Engineering Decision Framework
Problem
How to implement Design a 100K-Session Real-Time Voice & Multimodal AI Streaming Agent without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
When batching and tail latency compete for accelerator cycles, use Geo-DNS Anycast to regional WebRTC SFU edge POPs, sticky session affinity to stateful GPU Media Worker pods, a shared KV-cache prefix pool, and dual-stream lock-free ring buffers.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Design a 100K-Session Real-Time Voice & Multimodal AI Streaming Agent experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
intermediate

Sticky Session Affinity & GPU Media Worker Pod Architecture.

Why this matters: Pin each live session to a dedicated GPU Media Worker pod while avoiding hot-shard overload.

Because each session maintains an in-memory VAD FSM, streaming ASR decoder state, and active KV-cache pointers, round-robin load balancing would force expensive state serialization on every 20ms frame.

A Sticky Session Affinity Router (backed by Envoy + Redis/etcd lease table) pins session_id to a specific GPU Media Worker pod using least-loaded consistent hashing with bounded capacity (e.g., max 32 active streams per pod).

STAGE 3 · AFFINITY ROUTING

Sticky Session Affinity & Bounded Pod Leases

Sticky AffinityRoutersession-routerGPU Media Worker PodAworker-podGPU Media WorkerPod Bworker-pod30s Heartbeat Leaselease-storeRoutes if <32 streams

1.Capacity-Aware Hashing: Pure consistent hashing overloads pods with long calls; gate on active stream count + HBM.

2.Heartbeat Expiry: 30s TTL leases automatically reclaim zombie sessions after abrupt client disconnects.

Sticky session affinity pins live calls to stateful GPU Media Workers while gating on active stream count and HBM utilization.

04
intermediate

Dual-Stream Ring Buffer & Zero-Copy Intra-Pod Pipeline.

Why this matters: Eliminate Python GIL stalls and heap allocations by passing audio via lock-free dual-stream ring buffers.

At 50 frames/sec per stream × 30 streams/pod (1,500 frames/sec ingress + 1,500 frames/sec egress), allocating NumPy arrays or JSON objects per frame triggers Python GC pauses of 40–120ms—instantly breaching the 300ms SLA.

Each Media Worker pod uses a pre-allocated, lock-free Dual-Stream Ring Buffer (shared-memory C++/Rust arena): the Ingress Ring feeds 16kHz PCM slots to Silero VAD and ASR, while the Egress Ring holds outbound 20ms Opus frames with atomic read/write cursors.

STAGE 4 · DATA PLANE

Lock-Free Dual-Stream Ring Buffer & O(1) Barge-In Flush

Ingress PCM RingBufferingress-bufferColocatedVAD/ASR/LLMcompute-loopEgress Opus RingBufferegress-bufferAtomic Cursor Resetinterrupt-gateWrites synthesized Opus

1.Zero-GC Hot Path: Pre-allocated ring arenas keep audio thread p99 jitter under 0.5ms.

2.Instant Flush: Moving an atomic tail pointer drops 500ms of queued TTS audio in microseconds.

Lock-free dual-stream ring buffers eliminate GC stalls and enable microsecond-level O(1) egress audio flushing on barge-in.

05
intermediate

Shared KV-Cache Prefix Pool & Speculative Turn Overlap.

Why this matters: Share system-prompt and tool-schema KV blocks across all 100K sessions to slash HBM waste and TTFT.

Every voice agent session shares a 2,000–4,000 token system prompt, persona instructions, and MCP tool schemas.

Recomputing or duplicating those KV blocks across 30 concurrent streams per GPU wastes >40% of HBM. By backing vLLM/SGLang with a Shared KV-Cache Prefix Pool (RadixAttention / Automatic Prefix Caching), identical system-prompt and RAG-context prefixes are stored once in HBM and referenced copy-on-write by all active streams.

STAGE 5 · MEMORY POOL

Shared Radix KV-Cache Prefix Pool Across Active Streams

System & ToolPrefixesprefix-rootRadixAttention KVPoolshared-cachePer-Session TurnBlockssession-kvLRU + CPU DRAMOffloadtier-evictorBranches per-session KV

1.40% HBM Savings: Deduplicating system prompts lets each H100 host 2x more concurrent voice sessions.

2.Silence Offload: Sessions silent >15s offload KV pages to pinned host DRAM, freeing HBM for active speakers.

RadixAttention prefix sharing deduplicates system prompts across streams while offloading silent sessions to host DRAM.

06
advanced

Live Session Failover, Playout Checkpointing & Canary Rollouts.

Why this matters: Migrate active WebRTC calls transparently across GPU pods on hardware faults or rolling deployments.

GPU pods experience ECC errors, CUDA OOMs, and rolling model upgrades.

Because SFU edge POPs terminate the client's DTLS-SRTP connection, the client never sees a WebRTC disconnect if a backend GPU pod dies! Each GPU Media Worker checkpoints compact turn state (conversation transcript, playout-clock offset, tool state) to regional Redis every turn (<2ms async write).

STAGE 6 · FAILOVER

SFU-Shielded Sub-Second GPU Pod Migration

SFU Edge (PreservesICE)connection-anchorRedis TurnCheckpointerstate-storeStandby GPU Workerfailover-targetGraceful DrainControllerrollout-managerLoads turn state & offset

1.Zero Client Drop: Keeping DTLS-SRTP anchored at the SFU hides backend GPU pod restarts from users.

2.Silence-Boundary Drain: Rolling upgrades migrate sessions only during natural silence gaps between turns.

Anchoring WebRTC at the edge SFU and checkpointing turn state to Redis allows sub-second GPU pod failover with zero dropped calls.

07
advanced

End-to-End Observability, MOS Quality Scoring & Chaos Testing.

Why this matters: Monitor mouth-to-ear p95/p99 latency, barge-in reaction time, and Mean Opinion Score (MOS) in real time.

Standard HTTP APM metrics miss audio glitches.

Every 20ms Opus frame carries an RTP timestamp and sequence number, allowing the SFU and Media Worker to emit OpenTelemetry histograms for exact mouth-to-ear latency (VAD speech-end -> first TTS Opus packet ACK), barge-in abort latency (speech-onset -> egress ring flush), and jitter-buffer concealment rate.

STAGE 7 · OBSERVABILITY

Real-Time Voice Telemetry, UTMOS & SLA Alerting

RTP/NTP TraceProbeslatency-probeOTel MetricsCollectortelemetry-bus1% UTMOS QualityScorerquality-evaluatorClickHouse +PagerDutyalert-sinkStreams to ClickHouse

1.Synthetic Call Canaries: Automated WebRTC bots dial every POP every 60s to measure real mouth-to-ear latency.

2.False-Interrupt Metric: Track user 'Wait, I wasn't done' re-prompts as the gold-standard turn-detection KPI.

Per-turn RTP trace probes and 1% UTMOS scoring provide continuous visibility into mouth-to-ear latency and conversational quality.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why should DTLS-SRTP and ICE/TURN terminate at regional WebRTC SFU edge POPs rather than directly on the GPU Media Worker pods?

Recommended Learning Flow