I am running mediasoup on a server where some cpu core are already highly used by other services and I want to avoid interfering with them. Is there a way to assign workers to specific cpu cores?
Thanks!
P.S. maybe it helps to see why I want this. I got this error inside createWorker(). I know it looks like a memory problem, but I had enough memory so I am confused…:
CPU affinity is doable with Windows/Linux but not as straightforward with Apple. You should be able to sort a way to grab PID and affinity it to CPU #0.
Let’s just say this though…
Relying on the kernel for CPU scheduling is generally better than manually setting CPU affinity because the kernel dynamically optimizes resource use across all cores, balancing workloads, minimizing context switching, and maintaining cache efficiency. Once you start using CPU affinity, you need to manage it for all processes, or the kernel might push tasks onto cores you intended to isolate, leading to suboptimal performance. Overall, the kernel’s adaptive approach ensures better system performance and responsiveness in complex environments.