Sure, wait event times in any database will include some CPU
time, though ideally it should be minimal. Waits should be
instrumented as close to the off CPU wait event as possible, i.e.
if I’m doing an IO, then I want the wait to cover just the read
call:
start_wait('my_read_wait');
pread( ... );
end_wait('my_read_wait');
So my function that sets up the read will do some CPU that could
get caught under the cover of the wait itself and the call to
pread will use some CPU but most of the time should be waiting
for the actual I/O if the I/O is coming from storage.
start_wait('my_lock');
semtimedop(...);
end_wait('my_lock');
On MySQL I’ve noticed that average active sessions on CPU are
often well below what the host reports as CPU utilization. For
example if I have one connection on CPU a 100% of the time on a 2
vCPU host then CPU Utilization should be around 50%. There
might be …
[Read more]