What is CPU Steal Time?
In Linux, CPU steal time refers to the amount of time a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor. This measurement is often seen in virtualized environments like AWS, Azure, or Google Cloud.
In simpler terms, ‘steal time’ is time that a virtual CPU is ready to execute, but it couldn’t because the underlying physical CPU was busy with other tasks.
In more direct terms, this is a measurement of how oversold your hosting provider is, and how much CPU you need that you’re not getting. Note that many cloud providers offer non-guaranteed or “preemptible” instance types for which steal time should be affected. So this doesn’t necessarily mean you’re not getting what you are paying for.
If you’re experiencing a high CPU steal time, it might indicate that your VM is competing for resources with other VMs on the same physical host, which can lead to performance degradation.
It’s worth noting that a little bit of steal time isn’t a problem and is quite normal. But if you consistently see high levels, you might want to look into upgrading your VM, changing it to a non-preemptible type, or talking to your cloud service provider about the issue.
How to measure CPU Steal Time under Linux
In Linux, you can measure CPU steal time using a variety of command line tools. Here are some of the most common ones:
-
top
: This command provides a dynamic real-time view of the running system. The steal time is shown underst
in the%Cpu(s)
row. -
vmstat
: This command reports information about processes, memory, paging, block IO, traps, disks and cpu activity. You can use it to monitor the steal time with thest
column. -
iostat
: This command is used for monitoring system input/output device loading. Thesteal
field shows the time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor. -
sar
: The System Activity Reporter (sar
) also can provide information on CPU steal time. You can usesar -u
to see it.
Specific Commands
Here’s how you might use these tools to check CPU steal time:
-
top
: Simply typetop
in the command line. The steal time will be shown continuously. -
vmstat
: Typevmstat 1
in the command line to see system performance stats updated every second. The steal time will be shown in thest
column. -
iostat
: Typeiostat -c 1
in the command line to see CPU stats updated every second. The steal time will be shown in thesteal
column. -
sar
: You might have to install thesysstat
package to get thesar
command. After that, you can typesar -u 1
in the command line to see CPU stats updated every second. The steal time will be shown in the%steal
column.
Remember to replace 1
with whatever update frequency you prefer.
Call 1-828-376-0458 to Work With Linux Server Experts
Professional Linux support from senior Linux systems engineers.