Can you tell me.. I'm having 2 separate EC2 instan...
# ask-ai
a
Can you tell me.. I'm having 2 separate EC2 instances, each with 4 vCPUs and 8GB RAM. On 1 instance I've installed self hosted livekit server and on another I'm having my worker agent that is connected with that livekit server. I need to understand how many concurrent sessions I can consider on this scenario when there are always 2 participants over audio channel to be talking. Local participant will be voice ai bot and another participant will be a SIP participant.
t
Thanks for reaching out, Hiren. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding about how many concurrent 2‑participant audio sessions your setup can support (one LiveKit server on a 4 vCPU / 8 GB EC2, one worker agent on a separate 4 vCPU / 8 GB EC2; each session = voice AI bot + SIP participant, audio only). Summary estimate • LiveKit server (4 vCPU, 8 GB): can handle roughly 100–150 concurrent audio-only rooms. • Agent worker (4 vCPU, 8 GB): can handle roughly 25–40 concurrent agent sessions if the agent uses lightweight processing or cloud STT/TTS/LLM; if the agent runs heavy local inference, expect ~10–20 sessions. • Practical planning number: plan for ~30 concurrent sessions with this single-agent instance (agent is the likely bottleneck). Why • LiveKit audio forwarding is relatively cheap compared to video; the SFU can route hundreds of audio streams on 4 vCPUs, but per-agent AI work (STT/TTS/LLM/VAD) consumes additional CPU/RAM on the worker node and becomes the limiting factor. Quick recommendations to scale beyond ~30 sessions • Add more agent worker instances and distribute sessions across them (horizontal scaling). • Offload heavy inference to cloud APIs (OpenAI, cloud STT/TTS) to reduce CPU/RAM per session. • Monitor CPU, memory, and LiveKit Prometheus metrics and autoscale agent workers when CPU or queue length increases. • If you need high-density on a single machine, use larger instance types (more vCPUs or GPU) for local inference. Do you want a tighter estimate for your workload? If so, tell me: 1) whether your agent uses cloud or local STT/TTS/LLM, and which models; and 2) approximate CPU/RAM usage per agent job (if you’ve measured) or whether you want guidance for load-testing steps I can outline. Sources: Deploying LiveKit | LiveKit docs | Benchmarking | LiveKit docs | Intro to LiveKit | LiveKit docs | Quotas and limits | LiveKit docs | Deploying to custom environments | LiveKit Docs
a
What happens if I keep my worker agents also on the same livekit server EC2 instead of keeping it separate?
t
You're asking what happens if you run both the LiveKit server and your worker agents on the same 4 vCPU / 8 GB EC2 instance. Short answer: it works initially, but it creates strong risks for performance, reliability, and scaling — the agents are likely to become the bottleneck and can disrupt real‑time media. Key impacts • Resource contention: LiveKit (SFU) and agents compete for the same CPU, RAM, and network. Real‑time media forwarding is sensitive to CPU and network jitter, so contention causes audio latency, packet drops, and choppy audio. • CPU throttling risk: If you use burstable instance types (t3/t4g), sustained agent spikes can exhaust CPU credits and throttle the whole host, which will degrade LiveKit’s realtime performance. • Unpredictable latency: Heavy agent tasks (STT/TTS/LLM inference) cause CPU and scheduling spikes that increase packet processing latency for WebRTC. • Reliability coupling: A crash, high memory use, or heavy GC on the agent process can destabilize or force restarts of the LiveKit process on the same host, interrupting all sessions. • Scaling limitations: You can’t independently scale LiveKit vs agent capacity. Paying to scale one component forces scaling the other, increasing inefficiency and cost. When this setup might be acceptable • Small test/dev deployments with very low concurrent sessions and lightweight agent work. • Short experiments before you implement horizontal scaling or separate hosts. Recommended approach • Separate LiveKit server and agent workers onto different instances or node pools. • Scale agents horizontally (multiple worker instances) behind a dispatcher/load balancer. • Offload heavy inference to cloud APIs or dedicated GPU instances if needed. • Use fixed CPU instance families (c5/m5) rather than burstable types for production LiveKit hosts. • Monitor Prometheus metrics (LiveKit) and host CPU/memory on agents and autoscale agents based on CPU or queue backlog. If you want, I can: • Suggest a concrete separation and sizing plan for your current ~30-session target, or • Outline a simple load test to measure how much contention you observe when co‑located. Which would you prefer? Sources: Deploying to custom environments | LiveKit Docs | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | Deploy and scale agents on LiveKit Cloud | Deploying to production | LiveKit Docs