mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-01 22:48:25 +00:00
Limit the number of consecutive accept() in multi-process mode.
This produces a more evenly distributed load across the processes and slightly improves performance by reducing bottlenecks.
This commit is contained in:
parent
05be12bb20
commit
c2becdc403
@ -2555,8 +2555,14 @@ int event_accept(int fd) {
|
||||
struct session *s;
|
||||
struct task *t;
|
||||
int cfd;
|
||||
int max_accept;
|
||||
|
||||
while (p->nbconn < p->maxconn) {
|
||||
if (global.nbproc > 1)
|
||||
max_accept = 8; /* let other processes catch some connections too */
|
||||
else
|
||||
max_accept = -1;
|
||||
|
||||
while (p->nbconn < p->maxconn && max_accept--) {
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t laddr = sizeof(addr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user