Tuesday, May 04, 2021

Linux Tickless and CPU Isolation - microbenchmark

 How much can be gained when it comes to low latency and jitter by isolating CPUs on Linux?

Let's do a microbenchmark by using a tool called hiccups.


A single CPU server (overclocked).
Kernel booted with the following arguments:
    isolcpus=nohz,domain,managed_irq,15-17 irqaffinity=0-13 nohz_full=15-17 intel_idle.max_cstate=0 idle=poll
    nmi_watchdog=0 nowatchdog nosoftlockup intel_pstate=passive

First let's run the hiccups tool on CPU 14 (not isolated, etc.):
    # taskset -c 14 chrt --other 0 ./hiccups -r 60 | column -t -R 1,2,3,4,5,6
    cpu  threshold_ns  hiccups  pct99_ns  pct999_ns  max_ns
     14           120    60077      2578       3219    6932

Now let's run it on CPU 15:
    # taskset -c 14 chrt --other 0 ./hiccups -r 60 | column -t -R 1,2,3,4,5,6
    cpu  threshold_ns  hiccups  pct99_ns  pct999_ns  max_ns
     15           120    14654       248       1177    7651

This is about 10x difference.
It can be optimized even further.