Skip to content

High CPU usage when connecting #779

@holzgeist

Description

@holzgeist

Your environment.

What did you do?

We run livekit (which uses pion) on a k8s cluster.
Most of the data is already collected here, but here's a quick summary:

We run livekit with host_network: true to get UDP working without a UDP load balancer/proxy. This means that the pod can see all network interfaces on the host, including interfaces of each other pod. However, it doesn't reload the list of available interfaces (often enough) so that when pods are stopped on k8s, it still tries to access their interface.

We have a large range of possible UDP ports (50000-60000), so this loop tries 10k times for every interface that went missing since the process started. This is done for every user that connects to livekit

As a workaround we use the "Includes" interface filter to only try to bind to the public interface. But to be more resilient against kernel/hardware updates I'd rather not do this pinning.

Unfortunately I don't know how to provide you with a runnable example of this. Does this (and the referenced) issue contain enough information to tackle this problem?

What did you expect?

CPU usage that corresponds to number of simultaneous connections/streams

What happened?

Since the update to v1.8.3 (which updated pion/ice from v2 to v4), we see high CPU spikes to up to 50% for single participants that don't even publish any streams yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions