OPTIM: backend/random: never queue on the server, always on the backend

If random() returns a server whose maxconn is reached or the queue is
used, instead of adding the request to the server's queue, better add
it to the backend queue so that it can be served by any server (hence
the fastest one).
This commit is contained in:
Willy Tarreau 2020-09-29 16:58:30 +02:00
parent 9d85eb02d5
commit b88ae18021

View File

@ -548,6 +548,13 @@ static struct server *get_server_rnd(struct stream *s, const struct server *avoi
curr = prev;
} while (--draws > 0);
/* if the selected server is full, pretend we have none so that we reach
* the backend's queue instead.
*/
if (curr &&
(curr->nbpend || (curr->maxconn && curr->served >= srv_dynamic_maxconn(curr))))
curr = NULL;
return curr;
}