mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-07 01:31:35 +00:00
BUG/MEDIUM: fix maxaccept computation on per-process listeners
Christian Ruppert reported a performance degradation when binding a single frontend to many processes while only one bind line was being used, bound to a single process. The reason comes from the fact that whenever a listener is bound to multiple processes, the it is assigned a maxaccept value which equals half the global maxaccept value divided by the number of processes the frontend is bound to. The purpose is to ensure that no single process will drain all the incoming requests at once and ensure a fair share between all listeners. Usually this works pretty well, when a listener is bound to all the processes of its frontend. But here we're in a situation where the maxaccept of a listener which is bound to a single process is still divided by a large value. The fix consists in taking into account the number of processes the listener is bound do and not only those of the frontend. This way it is perfectly possible to benefit from nbproc and SO_REUSEPORT without performance degradation. 1.6 and 1.5 normally suffer from the same issue.
This commit is contained in:
parent
7a798e5d6b
commit
7c0ffd23d2
@ -8694,9 +8694,6 @@ out_uri_auth_compat:
|
||||
for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
|
||||
struct listener *listener;
|
||||
unsigned int next_id;
|
||||
int nbproc;
|
||||
|
||||
nbproc = my_popcountl(curproxy->bind_proc & nbits(global.nbproc));
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
/* Configure SSL for each bind line.
|
||||
@ -8741,6 +8738,15 @@ out_uri_auth_compat:
|
||||
/* adjust this proxy's listeners */
|
||||
next_id = 1;
|
||||
list_for_each_entry(listener, &curproxy->conf.listeners, by_fe) {
|
||||
int nbproc;
|
||||
|
||||
nbproc = my_popcountl(curproxy->bind_proc &
|
||||
listener->bind_conf->bind_proc &
|
||||
nbits(global.nbproc));
|
||||
|
||||
if (!nbproc) /* no intersection between listener and frontend */
|
||||
nbproc = 1;
|
||||
|
||||
if (!listener->luid) {
|
||||
/* listener ID not set, use automatic numbering with first
|
||||
* spare entry starting with next_luid.
|
||||
@ -8819,7 +8825,7 @@ out_uri_auth_compat:
|
||||
#endif /* USE_OPENSSL */
|
||||
}
|
||||
|
||||
if (nbproc > 1) {
|
||||
if (my_popcountl(curproxy->bind_proc & nbits(global.nbproc)) > 1) {
|
||||
if (curproxy->uri_auth) {
|
||||
int count, maxproc = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user