]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] sessions: only wake waiting listeners up if rate limit is OK
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Jul 2011 06:37:44 +0000 (08:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Jul 2011 06:37:44 +0000 (08:37 +0200)
Instead of waking a listener up then making it sleep, we only wake them up
if we know their rate limit is fine. In the future we could improve on top
of that by deciding to wake a proxy-specific task in XX milliseconds to
take care of enabling the listeners again.

src/session.c

index 65c92db0d1f0f3142e7b511258074e7d0475253b..8b50aa9221848164aedb45c330127296f3c6e318 100644 (file)
@@ -2096,7 +2096,8 @@ struct task *process_session(struct task *t)
        if (!LIST_ISEMPTY(&global_listener_queue))
                dequeue_all_listeners(&global_listener_queue);
 
-       if (!LIST_ISEMPTY(&s->fe->listener_queue))
+       if (!LIST_ISEMPTY(&s->fe->listener_queue) &&
+           (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0))
                dequeue_all_listeners(&s->fe->listener_queue);
 
        if (unlikely((global.mode & MODE_DEBUG) &&