bulky-yak-50122
12/16/2025, 11:05 AMtall-airline-16756
12/16/2025, 11:05 AMtall-airline-16756
12/16/2025, 11:05 AMAJ_76SpRUKaiYeK in room RM_JJ2RJuopMbFh is using high memory: 553.36 MB, which exceeds the configured warning threshold of 500 MB. Because memory_limit_mb is 0, no hard limit is set so the process won't be auto-terminated.
What it means:
• The agent is approaching (or exceeding) a level you consider unsafe — it's a warning, not an immediate crash.
• Common causes: loading large models (STT/TTS/LLM), heavy media processing, or high concurrency in that agent.
Actions you can take now:
1. Monitor that process for further growth and check other agents for similar warnings.
2. If this is expected occasional use, leave as-is but continue observing.
3. If it’s sustained or widespread, set a memory limit (memory_limit_mb) to cap usage or configure a higher warning threshold if appropriate.
4. Reduce per-agent load: lower concurrency, avoid loading large models per worker, or offload heavy tasks.
5. Scale horizontally: run additional agent workers so each handles less memory pressure.
If you want, tell me:
• whether this warning is recurring or one-off,
• what the agent is doing (STT/TTS/LLM/media processing),
and I’ll suggest concrete memory-limit values and configuration changes.
Sources: Capturing the First Few Seconds of a Call for Processing | Deploying to custom environments | LiveKit docs | Agent server options | LiveKit docs | Agents Framework | livekit/livekit_composite | DeepWikibulky-yak-50122
12/16/2025, 11:07 AMtall-airline-16756
12/16/2025, 11:07 AMmemory_limit_mb is 0, so the process won’t be auto-killed.
• Realtime LLM agents commonly spike memory when loading models, keeping model contexts/token caches, or handling multiple simultaneous sessions.
Practical next steps
1. Quick checks
◦ Is this recurring or a single spike?
◦ Which model size are you running (tiny / base / larger)?
◦ How many concurrent sessions or in-flight requests per agent?
1. Immediate mitigations
◦ Set a reasonable memory_limit_mb to prevent runaway memory (pick a limit slightly above typical peak after testing).
◦ Increase the warning threshold if this usage is expected and safe for your host memory.
1. Reduce per-agent memory
◦ Use a smaller model or a distilled/quantized variant.
◦ Limit concurrency per agent so each worker handles fewer sessions.
◦ Reduce retained context length or aggressively prune token caches between calls.
1. Architecture/scale options
◦ Deploy additional agent workers to spread sessions across processes.
◦ Offload heavy LLM work to separate services (inference cluster) and keep the realtime agent as a thin orchestrator.
If you want, tell me:
• model name/size, typical concurrency, and whether this is repeated — I’ll recommend a concrete memory_limit_mb and concurrency setting.bulky-yak-50122
12/16/2025, 11:08 AMtall-airline-16756
12/16/2025, 11:08 AMmemory_limit_mb to a value slightly above your observed peaks (e.g., if peaks ~550 MB, try 700–800 MB) so a runaway process is constrained.
• Reduce concurrency per agent so each process handles fewer simultaneous sessions.
• Trim context length or drop inactive session contexts sooner to free token caches.
Medium-term changes
• Use smaller/quantized model variants if latency and quality allow.
• Move heavy inference to a dedicated inference pool (separate processes/hosts) and keep realtime agents as lightweight proxies.
• Add horizontal capacity (more agent workers) so load per agent falls.
Monitoring and tuning
• Track memory over time per PID/job to identify growth patterns (steady leak vs spikes).
• If growth is steady between requests, suspect retained caches or a memory leak; if spikes align with model loads or bursts, it’s capacity/concurrency.
If you share model size, concurrency, and whether memory grows steadily or in spikes, I’ll recommend a concrete memory_limit_mb and concurrency settings.bulky-yak-50122
12/16/2025, 11:09 AMtall-airline-16756
12/16/2025, 11:09 AMmemory_limit_mb and warning threshold).
With those I’ll suggest a memory_limit_mb, a recommended concurrency cap, and immediate config changes to reduce recurrence.bulky-yak-50122
12/16/2025, 11:10 AMtall-airline-16756
12/16/2025, 11:10 AMmemory_limit_mb and memory_warn_mb for your agent setup, or
• Recommend monitoring metrics/alerts to add while you test these limits. Which would you like?bulky-yak-50122
12/16/2025, 11:10 AMtall-airline-16756
12/16/2025, 11:11 AMagent:
job_id: AJ_76SpRUKaiYeK
room_id: RM_JJ2RJuopMbFh
realtime_llm:
model: "gemini-2.5-flash-native-audio-preview-09-2025"
memory:
memory_warn_mb: 700
memory_limit_mb: 900
concurrency:
max_sessions_per_agent: 4
context:
inactivity_drop_seconds: 600 # drop/truncate context after 10 minutes idle
max_retained_tokens: 2048
2) Process placement / scaling suggestion
• Run 3 agent processes (or hosts) to cover 10 sessions: 3 agents * 4 concurrency = 12 capacity.
• If using containers, set container memory limit slightly above memory_limit_mb (e.g., 1 GiB) to align host-level enforcement.
Docker run example (adjust names/IDs):
docker run --name livekit-agent-1 --memory=1g \
-e AGENT_CONFIG=/config/agent1.yaml \
livekit/agent:latest
3) Monitoring & alerting checklist
• Metrics to collect per process (PID/job):
◦ RSS memory (MB)
◦ CPU %
◦ Sessions count / active connections
◦ Average latency per request
• Alert rules:
◦ Warn: memory > 700 MB for 2 consecutive minutes (send Slack/email)
◦ Critical: memory > 900 MB for 30s (auto-restart or remove from rotation)
◦ Sessions > configured concurrency (trigger scale-out)
• Logs to watch:
◦ OOM or container kill events
◦ Realtime LLM errors/timeouts and model load events
• Visualization:
◦ Dashboard with per-agent memory timelines, concurrency, and request latency (24–72h view)
4) Operational runbook (quick)
1. Deploy config changes to one agent.
2. Observe for 24h: memory peaks should stay <900 MB and warnings near 700 MB.
3. If still >900 MB, lower per-agent concurrency to 3 or add another agent host.
4. If memory grows steadily between requests, capture heap/profile to inspect retained caches (may indicate leak or large retained contexts).
If you want, I can produce:
• a ready-to-deploy agent YAML for your environment, or
• example Prometheus alert rules and a Grafana dashboard JSON for the monitoring checks. Which would you like?