mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MINOR: mux-quic: use sched call time for pacing
QUIC pacing was recently implemented to limit burst and improve overall bandwidth. This is used only for MUX STREAM emission. Pacing requires nanosecond resolution. As such, it used now_cpu_time() which relies on clock_gettime() syscall. The usage of clock_gettime() has several drawbacks : * it is a syscall and thus requires a context-switch which may hurt performance * it is not be available on all systems * timestamp is retrieved multiple times during a single task execution, thus yielding different values which may tamper pacing calculation Improve this by using task_mono_time() instead. This returns task call time from the scheduler thread context. It requires the flag TASK_F_WANTS_TIME on QUIC MUX tasklet to force the scheduler to update call time with now_mono_time(). This solves every limitations listed above : * syscall invokation is only performed once before tasklet execution, thus reducing context-switch impact * on non compatible system, a millisecond timer is used as a fallback which should ensure that pacing works decently for them * timer value is now guaranteed to be fixed duing task execution
This commit is contained in:
parent
044452546e
commit
22bd92a87f
@ -18,6 +18,7 @@
|
||||
#include <haproxy/quic_pacing-t.h>
|
||||
#include <haproxy/quic_stream-t.h>
|
||||
#include <haproxy/stconn-t.h>
|
||||
#include <haproxy/task-t.h>
|
||||
#include <haproxy/time-t.h>
|
||||
|
||||
/* Stream types */
|
||||
|
@ -2996,6 +2996,7 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
||||
|
||||
qcc->wait_event.tasklet->process = qcc_io_cb;
|
||||
qcc->wait_event.tasklet->context = qcc;
|
||||
qcc->wait_event.tasklet->state |= TASK_F_WANTS_TIME;
|
||||
qcc->wait_event.events = 0;
|
||||
|
||||
qcc->proxy = prx;
|
||||
|
@ -1,16 +1,17 @@
|
||||
#include <haproxy/quic_pacing.h>
|
||||
|
||||
#include <haproxy/quic_tx.h>
|
||||
#include <haproxy/task.h>
|
||||
|
||||
/* Returns true if <pacer> timer is expired and emission can be retried. */
|
||||
int quic_pacing_expired(const struct quic_pacer *pacer)
|
||||
{
|
||||
return !pacer->next || pacer->next <= now_mono_time();
|
||||
return !pacer->next || pacer->next <= task_mono_time();
|
||||
}
|
||||
|
||||
/* Notify <pacer> about an emission of <sent> count of datagrams. */
|
||||
void quic_pacing_sent_done(struct quic_pacer *pacer, int sent)
|
||||
{
|
||||
pacer->next = now_mono_time() + pacer->cc->algo->pacing_rate(pacer->cc) * sent;
|
||||
pacer->next = task_mono_time() + pacer->cc->algo->pacing_rate(pacer->cc) * sent;
|
||||
pacer->last_sent = sent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user