mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-27 08:01:15 +00:00
[OPTIM] maintain_proxies: only wake up when the frontend will be ready
It's not needed to try to check the frontend's freq counter every millisecond, we can precisely compute when to wake up.
This commit is contained in:
parent
bb9251ed8f
commit
efcbc6e66d
@ -383,10 +383,13 @@ void maintain_proxies(int *next)
|
|||||||
if (p->fe_maxsps && read_freq_ctr(&p->fe_sess_per_sec) >= p->fe_maxsps) {
|
if (p->fe_maxsps && read_freq_ctr(&p->fe_sess_per_sec) >= p->fe_maxsps) {
|
||||||
/* we're blocking because a limit was reached on the number of
|
/* we're blocking because a limit was reached on the number of
|
||||||
* requests/s on the frontend. We want to re-check ASAP, which
|
* requests/s on the frontend. We want to re-check ASAP, which
|
||||||
* means in 1 ms because the timer will have settled down. Note
|
* means in 1 ms before estimated expiration date, because the
|
||||||
* that we may already be in IDLE state here.
|
* timer will have settled down. Note that we may already be in
|
||||||
|
* IDLE state here.
|
||||||
*/
|
*/
|
||||||
*next = tick_first(*next, tick_add(now_ms, 1));
|
int wait = 1000 / p->fe_maxsps - 1;
|
||||||
|
wait = MAX(wait, 1);
|
||||||
|
*next = tick_first(*next, tick_add(now_ms, wait));
|
||||||
goto do_block;
|
goto do_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user