Threads with low priority prevents other threads with normal priority from execution Threads with low priority prevents other threads with normal priority from execution kubernetes kubernetes

Threads with low priority prevents other threads with normal priority from execution


According to this forum thread, we are not the only ones with this problem.Thread scheduling seems to work fundamentally differently within a Docker container (or K8s cluster).

We tried a lot and were able to solve the problem with a mixture of throttling and Thread.Sleep(0).

Note the following documentation for Thread.Sleep

If the value of the millisecondsTimeout argument is zero, the threadrelinquishes the remainder of its time slice to any thread of equalpriority that is ready to run

Without Thread.Sleep(0), CPU-intensive threads cause that no other threads have been processed. No timers were called either. Setting a low thread priority is ineffective within a Docker container.