can you give me livekit-cli's load test command wh...
# ask-ai
a
can you give me livekit-cli's load test command where I can check load test of 100 rooms having 2 participants in each room on audio track only.. 2 participants can be local = ai agent and remote = user participant. Please suggest how can I do load test benchmarking here?
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.
Acknowledged — you're asking for the exact
livekit-cli
(lk) load-test command to simulate 100 rooms × 2 participants (audio-only), plus brief benchmarking guidance. Below is a ready-to-run example and concise tips. Command (audio-only, 100 rooms, 1 publisher + 1 subscriber per room):
Copy code
lk load-test \
  --url wss://your-livekit-server.example.com \
  --api-key YOUR_API_KEY \
  --api-secret YOUR_API_SECRET \
  --rooms 100 \
  --concurrency 100 \
  --audio-publishers 1 \
  --subscribers 1 \
  --video-publishers 0 \
  --video-subscribers 0 \
  --run-subscriber-task true \
  --publish-bitrate 32k
Notes on flags: • `--rooms 100`: create 100 rooms. • `--concurrency 100`: run clients concurrently (one pair per room). •
--audio-publishers 1
and `--subscribers 1`: one publisher and one subscriber per room (audio-only). •
--video-publishers 0
/ `--video-subscribers 0`: disables video. • `--run-subscriber-task true`: lets subscribers perform typical subscription actions. • `--publish-bitrate 32k`: example target audio bitrate — adjust to match your codec/quality target. Benchmarking checklist (concise): • Run the load generator on a separate machine (or scaled machines) with sufficient CPU, network, and file descriptors (
ulimit -n 65535
). • Monitor LiveKit server metrics: CPU, memory, network throughput (bytes/sec), and packets/sec. • Watch room/participant-level stats: packet loss, jitter, RTT, and actual bitrate. • Start with smaller scale (e.g., 10 rooms) and ramp up to 100 to observe resource/use thresholds. • Repeat tests for different
--publish-bitrate
values and network conditions to profile behavior. • Ensure load test traffic is within any quota or plan limits for your deployment. Would you like a variant that simulates multiple publishers-per-room, staggered ramps, or an example invoking secure token generation for participants? Sources: Benchmarking | LiveKit docs
a
giving me error for --rooms, --concurrency, --run-subscriber-task and --publish-bit-rate doesn't exist in the livekit cli command..
t
You're right — those flags don't exist. Regarding your request to simulate 100 rooms × 2 participants (audio-only), here’s what you can do and a working approach. Quick acknowledgement: you saw errors for
--rooms
,
--concurrency
,
--run-subscriber-task
, and
--publish-bit-rate
— those flags are invalid in the official
lk load-test
CLI. What works • The
lk load-test
command targets a single room via
--room
. • Use
--audio-publishers
and
--subscribers
(and set video publishers/subscribers to 0) to do audio-only tests. Example — single room with 2 audio participants (both publishing):
Copy code
lk load-test \
  --url wss://your-livekit-server.example.com \
  --api-key YOUR_API_KEY \
  --api-secret YOUR_API_SECRET \
  --room test-room-1 \
  --audio-publishers 2 \
  --video-publishers 0 \
  --subscribers 0
Simulate 100 rooms • Run 100 instances of
lk load-test
, each with a unique room name. Example bash loop (starts each test in background):
Copy code
for i in {1..100}; do
  lk load-test \
    --url wss://your-livekit-server.example.com \
    --api-key YOUR_API_KEY \
    --api-secret YOUR_API_SECRET \
    --room "loadtest-room-$i" \
    --audio-publishers 1 \
    --subscribers 1 \
    --video-publishers 0 \
    --video-subscribers 0 &
done
wait
This creates 100 rooms, each with 1 publisher + 1 subscriber (audio-only). Benchmarking tips (concise) • Run the load generator on separate machines or a cluster with enough CPU, network, and file descriptors (
ulimit -n 65535
). • Ramp gradually (start with 10 rooms, then 50, then 100) to find bottlenecks. • Monitor LiveKit server metrics: CPU, memory, network throughput, packets/sec, per-room/participant stats (bitrate, RTT, packet loss). • Adjust publisher audio bitrate by configuring the publisher in the load-test code or build a custom load client if you need precise bitrate control. If you want, I can: • Provide a Python or Docker script to orchestrate those 100 parallel
lk load-test
runs. • Show how to simulate one publisher + one subscriber where the subscriber acts like an “AI agent” (subscribe-only behavior) rather than publishing. Which follow-up would you like?