red-television-3815
02/22/2026, 12:05 PMtall-airline-16756
02/22/2026, 12:05 PMtall-airline-16756
02/22/2026, 12:05 PMred-television-3815
02/22/2026, 12:08 PMtall-airline-16756
02/22/2026, 12:08 PMMultilingualModel) and keeps its own sliding context (the last four turns). There is no centralized batching layer that groups multiple sessions’ inferences together.
◦ Inference runs on the shared process for each session as transcriptions arrive, so requests are processed independently for each session.
• CPU contention
◦ The model is CPU-only and typical per-turn inference latency is on the order of tens to a few hundred milliseconds, so concurrent sessions increase CPU load linearly.
◦ Because multiple model instances run in the same server process, CPU becomes the primary contention point when concurrency rises.
◦ To avoid throttling under sustained load, compute-optimized instances (e.g., c6i/c7i) are recommended; burstable instance types (t3/t4) can exhaust CPU credits and cause timeouts.
• Memory behavior
◦ Model weights are cached/shared at the process level (not duplicated per session), so weight memory is not multiplied by sessions.
◦ Each session keeps per-session state (context windows), so overall memory usage grows roughly linearly with number of sessions, but the memory footprint per session is small (< ~500 MB model footprint overall; session state is modest).
• Scaling approach
◦ There is no software-level batching or inference queueing. Scaling is achieved by provisioning sufficient CPU/RAM on agent servers and adding more agent servers when needed. The agent/job distribution assigns sessions across servers so each session is handled exactly once.
◦ Example baseline: a 4-core, 8 GB machine typically supports ~10–25 concurrent agent jobs depending on active plugins (VAD, noise cancellation, turn detector). Load tests (30 concurrent agents using Silero VAD) have shown ~3.8 cores and ~2.8 GB peak usage, indicating CPU is usually the limiting factor.
If you want, I can help with either of these next steps
• Estimate required CPU/RAM for your expected concurrency and which plugins you’ll run.
• Suggest a simple load-test plan and the exact metrics to collect (CPU, p95/p99 inference latency, memory, VAD timeouts).
• Show how to horizontally scale agent servers and what thresholds to watch for to trigger autoscaling.
Which of those would be most helpful for your environment?
Sources: LiveKit turn detector plugin | LiveKit Documentation | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | Updating the Turn Detector Model | LiveKit | Improving voice AI&#39;s turn detection with transformers | Self-hosted deployments | LiveKit Documentationred-television-3815
02/22/2026, 1:45 PMtall-airline-16756
02/22/2026, 1:46 PMduration or streaming stalls increase under concurrency, STT is the bottleneck.
1. Turn detector / model inference latency
◦ Per-inference latency for the turn detector (typical single inference is ~50–160 ms). If you see much higher latencies or spikes that correlate with concurrency, the turn detector (or CPU contention) is causing the EOU increase.
◦ Track p50/p95/p99 inference latency across sessions.
1. System/resource metrics
◦ Host CPU usage (%), per-core utilization, run queue length.
◦ Memory usage (process RSS) and swap activity.
◦ If CPU is saturated (high per-core usage or long runnable queue), inference will be delayed even if individual model calls are short.
How to attribute delay (simple math)
• For each EOU event:
◦ If transcription_delay is the majority of end_of_utterance_delay → STT is primary culprit.
◦ If transcription_delay is small but end_of_utterance_delay is large → turn detection (inference, VAD adjustments, or process contention) is likely responsible.
◦ Log both timings together so you can compute: turn_detector_delay = end_of_utterance_delay − transcription_delay.
Practical traces/observability to enable
• Trace spans for: audio ingestion → STT request → STT response → turn-detection inference → EOU event.
• Logs that include timestamps for: speech end detection, STT finalization, model inference start/end, EOU emission.
• Agent observability dashboard / trace view to inspect those spans per session.
What to watch for under concurrency
• Increasing STT durations or queueing in STT plugin: suggests STT backend or network throughput limits.
• Rising model inference p95/p99 or CPU run queue: suggests CPU contention (multiple per-session model instances executing concurrently).
• Signs of throttling on burstable VMs (e.g., t3/t4): indicates CPU credit exhaustion causing sudden latency spikes.
Quick checks to run now
1. Capture a sample of eou_metrics_collected for several sessions at both low and high concurrency.
2. Compare transcription_delay vs end_of_utterance_delay per session.
3. Correlate those with host CPU utilization and model inference latency during the same interval.
Immediate mitigations while you investigate
• Move agents to compute‑optimized instances (e.g., c6i/c7i) if you’re on burstable VMs.
• Reduce per-server concurrency temporarily to see if EOU improves (this isolates CPU contention).
• If STT is the issue, consider switching STT provider/region or enabling streaming configs that reduce finalization delay.
If you’d like, I can:
• Provide the exact log/trace fields to capture for each span.
• Suggest a short load-test script and the thresholds to monitor (CPU, p95 inference latency, transcription_delay).
• Help interpret a short sample of your collected metrics (paste a few example events and I’ll point to the likely root cause).
Which help would you prefer next?
Sources: STT Metrics | LiveKit Documentation | LiveKit turn detector plugin | LiveKit Documentation | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | examples/frontdesk | livekit/livekit_composite | DeepWiki | Streamline troubleshooting with Agent Observabilityred-television-3815
02/22/2026, 1:47 PMtall-airline-16756
02/22/2026, 1:47 PMimport asyncio
import logging
from datetime import datetime
from livekit.agents.metrics import STTMetrics, EOUMetrics
logger = logging.getLogger("eou-debug")
logger.setLevel(<http://logging.INFO|logging.INFO>)
# Handlers assume your AgentSession exposes .stt and emits these events
def on_stt_metrics(metrics: STTMetrics):
# Important fields to capture
<http://logger.info|logger.info>(
"STT_METRIC ts=%s session=%s duration=%.3fs audio_duration=%.3fs streamed=%s error=%s",
datetime.fromtimestamp(metrics.timestamp).isoformat(),
getattr(metrics, "session_id", "unknown"),
metrics.duration,
getattr(metrics, "audio_duration", 0.0),
metrics.streamed,
metrics.error,
)
def on_eou_metrics(metrics: EOUMetrics):
# Key fields to capture for EOU diagnosis
<http://logger.info|logger.info>(
"EOU_METRIC ts=%s session=%s end_of_utterance_delay=%.3fs transcription_delay=%.3fs speech_id=%s",
datetime.fromtimestamp(metrics.timestamp).isoformat(),
getattr(metrics, "session_id", "unknown"),
metrics.end_of_utterance_delay,
metrics.transcription_delay,
metrics.speech_id,
)
# Compute inferred turn detector contribution
td_delay = metrics.end_of_utterance_delay - metrics.transcription_delay
<http://logger.info|logger.info>("INFERRED_TURN_DETECTOR_DELAY session=%s td_delay=%.3fs",
getattr(metrics, "session_id", "unknown"), td_delay)
# Example wiring into your session setup
async def attach_debug_handlers(session):
# subscribe to STT metrics
session.stt.on("metrics_collected", lambda m: asyncio.create_task(async_wrap(on_stt_metrics, m)))
# subscribe to EOU metrics
session.stt.on("eou_metrics_collected", lambda m: asyncio.create_task(async_wrap(on_eou_metrics, m)))
async def async_wrap(fn, *args, **kwargs):
try:
return fn(*args, **kwargs)
except Exception:
logger.exception("error in metrics handler")
What to log alongside those events
• Timestamp (ISO), session/room id, speech_id, user id, host CPU/mem snapshot (at same timestamp).
• If you have traces, record spans for: audio_end → STT_request → STT_response → turn_detector_inference → eou_emitted.
Suggested short investigation steps
1. Collect ~100 EOU events at low concurrency and ~100 at your target high concurrency.
2. Compare median/p95/p99 of:
◦ transcription_delay (STT)
◦ inferred turn_detector_delay (end_of_utterance_delay − transcription_delay)
◦ host CPU p95/p99 during those windows
1. If transcription_delay rises with concurrency → focus on STT (network, provider throughput, streaming vs finalization).
2. If inferred turn_detector_delay rises while transcription_delay stays low → focus on model inference / CPU contention (move to compute-optimized instances or reduce per-server concurrency).
If you want, I can:
• Produce a small script that fetches these events from your logs or tracing backend and produces a short report (p50/p95/p99 and correlation with CPU).
• Help interpret a few sample log lines you capture (paste 5–10 lines and I’ll point to the likely root cause).
Which would you prefer next?
Sources: LiveKit turn detector plugin | LiveKit Documentation | Improved End-of-Turn Model Cuts Voice AI Interruptions 39% | Turns overview | LiveKit Documentation | AssemblyAI plugin guide | LiveKit Documentation | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS