ZLMediaKit/ZLToolKit

Uneven load distribution between threads on the TCP server

TheMadius opened this issue · 5 comments

Hello. There was a problem with uneven load distribution on the TCP server. With the simultaneous mass addition of RTSP flows, the following problem arises
image

When adding a delay, the following distribution occurs

image

Is it possible to achieve such results without adding a delay?

I confirm. I observe the same uneven load when adding video streams very quickly

The load balancing algorithm of zltoolkit is not round robin,
So some imbalances are reasonable。

There is a thread load evaluation algorithm inside the zltoolkit, which has latency and may not be accurately evaluated in the short term.

This is the load evaluation algorithm:

class ThreadLoadCounter {

This is the algorithm for obtaining the thread with the lowest load:

TaskExecutor::Ptr TaskExecutorGetterImp::getExecutor() {

Thank you