brief-vase-33757
03/01/2025, 4:38 AMgray-monkey-83525
03/01/2025, 4:38 AMload_fnc
and load_threshold
parameters in the WorkerOptions
configuration. The load_fnc
returns a value between 0 and 1, indicating how busy the worker is, while the load_threshold
is the load value at which the worker will stop accepting new jobs. By default, the load_fnc
returns the CPU usage of the worker, and the load_threshold
is set to 0.75.
The number of calls a worker can handle depends on the system resources and the configuration of the worker. For example, a 4-core machine can typically handle about 30 concurrent voice agents, as mentioned in LiveKit's deployment guide. The LiveKit server sends session information to the worker, which includes details necessary for the worker to instantiate the agent and join the room.
Would you like more detail on any specific aspect?
Sources:
- https://docs.livekit.io/agents/deployment/#Rollout
- https://docs.livekit.io/agents/build/anatomy/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.brief-vase-33757
03/01/2025, 5:02 AMbrief-vase-33757
03/01/2025, 5:02 AMgray-monkey-83525
03/01/2025, 5:02 AMload_fnc
, you need to define a function that returns a value between 0 and 1, representing the current load of the worker. This function can be customized to measure different metrics, such as CPU usage, memory usage, or any other relevant resource metric. According to LiveKit documentation, the load_fnc
is typically used to determine how busy a worker is and whether it can accept new jobs.
Here's a basic example of how you might implement a load_fnc
that measures CPU usage:
import psutil
def load_fnc():
# Return the current CPU usage as a value between 0 and 1
return psutil.cpu_percent() / 100.0
Would you like more detail on implementing or customizing this function?
Sources:
- https://docs.livekit.io/python/livekit/agents/index.html#livekit.agents.WorkerOptions 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.brief-vase-33757
03/01/2025, 5:04 AMgray-monkey-83525
03/01/2025, 5:04 AM