VMware Cloud Community
Sylvie_
Contributor
Contributor

vCPU max latency below a few microseconds ?

Hi,

We have a networking intensive application running inside a CentOS 7.6 VM with 8 vCPUs. It is latency sensitive and needs response time around a few microseconds but sometimes the threads are stuck for more than 1 millisecond.

BIOS configuration : no hyperthreading, power management performance (C1E disable, C States disable)

ESXi 6.5 configuration :

   Only one VM running

   host power management = high performance

   VM latency sensitivity = high

   VM 2 network cards PCI passthrough

   Setting VM CPU affinities gives worst results

Linux is configured with isolcpus. "perf sched" shows that no other process is scheduled on the same cores when the 1 msec delay occurs.

esxtop cpu shows that the VM %RDY is regularly above 0,3 %.

esxtop power management shows that every physical cpu core is sometimes put in the C1 state.

sched-stats shows that some system processes are running on the same CPU as the VM vCPUs. We also see that the VM CPUs are often moved around the different CPU cores.

Is it possible to associate vCPUs to physical CPUs so they never get moved to another CPU ?

Is it possible to force ESXi system threads to be scheduled only on CPUs not in use by the VM ?

Is it possible to completely disable power management so the CPUs never enter the C1 state ?

Are there other reasons than ESXi scheduling and power management which could explain such high latency ?

Is there a way to configure ESXi and VM so that the vCPUs always get response times less than a few microseconds ?

Thanks,

Sylvie

Reply
0 Kudos
2 Replies
jwdg
Contributor
Contributor

Hi Sylvie

Apologies if any of this gos over stuff you've already tried! CPU affinity (and indeed latency sensitivity) should do what you want for VMs, but according to Denneman & Hagoort's deep dive[*]: "Be aware that it never dedicates the physical CPU to the VM as the VMkernel schedules all its processes across all available pCPUs, regardless of any custom setting a VM has."

I assume you did provide 8 cores worth of CPU reservation too alongside the latency sensitivity? How many pCPUs do you have and what type of CPU are they?

Things I discovered when chasing down performance issues around CPU clock frequencies:

1) Turbo Boost - which increases clock speed on cores temporarily (within thermal constraints)

2) AVX Turbo states - if any AVX2 instructions are used, the core speed (or all cores dependent on processor model) is dropped to mainatin thermal limits, and is held at the lower value for 1ms after the klast AVX2 instruction is executed (that shouldn't be a total stall, though, just a core frequency reduction).

See, for example:https://en.wikichip.org/wiki/intel/frequency_behavior

On C-states: D&H again (though they say nothing about AVX2 clocking details):

"If absolute consistency is necessary, we recommended disabling Turbo Boost Technology as well. Again, we recommend enabling this feature in the BIOS, but programmatically adjusting this in vSphere. Select the Custom user-defined power management policy in vSphere and select the Advanced System settings and set the value to 99 of the Power.MaxFreqPCT setting.

Please note that the custom policy defaults to Balanced. If you need to disable TB, but also want to set MinFreqPct to 99, UseCStates to False."

My interest in this is that I too have been seeing short duration scheduling latency spikes (in my case to 10s  of milliseconds) - but in my case I need consistency (latency *always* below 10ms) rather than ultra-low latency per se. My other perception is that 6.5 produces higher %RDY values for some of my workloads than 6.0 (I started a thread here a few days ago about it, no replies!) and I have a call open with VMWare about it, so I think there is a perfomance change in the 6.5 scheduler. Are you in a position to run the workload on 6.0 for comparison?

Maybe there are some ideas there, but I have no knowledge about scheduler intricacies beyond what is published (I think it's supposed to "just work" so it's hard to find anything that goes beyond what's in the manual or the Deep Dive white paper). I'd love there to be a "vSphere Internals" course so as not to have to guess/experiment to answer some of these questions.

John

[*] "VMWare vSphere 6.5 Host Resources Deep Dive", Frank Denneman, Niels Hagoort. Available by signing up at Rubrik | eBook: VMware vSphere 6.5 Host Resources Deep Dive

Reply
0 Kudos
Sylvie_
Contributor
Contributor

Hi John,

Thanks a lot for your valuable answer.

The host is a Skylake-SP 12-cores single processor (no numa).

We provide 8 cores because the application has 7 threads pinned each to one core and each thread uses 100% cpu all the time. The remaining core is for the linux system.

We tried CPU affinity but the result was worst and %RDY was higher.

We have to investigate around CStates and AVX turbo states. We will also study the Deep Dive ebook.

I will post a feedback here when we get more results.

Sylvie

Reply
0 Kudos