MINOR: mux-quic: use sched call time for pacing
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 21 Nov 2024 15:20:15 +0000 (16:20 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 25 Nov 2024 10:21:45 +0000 (11:21 +0100)
commit22bd92a87f835280200b42c6048d7e51bc99ea24
tree243043232784844cbe7111bd5eea15f3229236a9
parent044452546eaad056187070471efef87452da79d5
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
include/haproxy/mux_quic-t.h
src/mux_quic.c
src/quic_pacing.c