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:
willy tarreau 2006-03-19 19:36:48 +01:00
parent 05be12bb20
commit c2becdc403

View File

@ -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);