Workers and load balacning

Valentin V. Bartenev vbart at
Tue Sep 12 20:34:04 UTC 2017

On вторник, 12 сентября 2017 г. 22:58:51 MSK Geoffrey Hartz wrote:
> Hi all!
> while testing unit I noticed that for a little project in python (based on
> Django) the load balacing between workers are unexpected when setting
> "workers" > 1
> I load benchmark with "wrk" and the following happens:
> - the very first seconds I see all workers reaching 30-40% of CPU usage
> - right after only one worker is at 100% CPU usage and the other ones are
> iddle
> The overall performance is equivalent to 1 CPU core.
> For example with nginx starting with version 1.9.1 the feature "REUSE_PORT"
> is available to load balance between workers, why not using this for Unit
> too?

Unit has a way more complex architecture than nginx.  Application worker 
processes don't accept connections at all.  They get requests from the router 
process using shared memory IPC and return responses back.  The router process 
uses a number of asynchronous threads to accept connections (one per core).

It most likely that you have experienced a bug.

  wbr, Valentin V. Bartenev

More information about the unit mailing list