top命令中cpu信息详解

在上一篇,给大家简单讲解了top命令的使用,今天给大家详细讲解一下其中cpu使用情况,从中可以判断一些主机的情况。

top命令运行界面

cpu的使用情况有8个指标,通过top命令手册可得知各个指标的意义:

us : time running un-niced user processes (用户使用的cpu时间占比)
sy : time running kernel processes (系统或者内核使用的cpu时间占比)
ni : time running niced user processes
id : time spent in the kernel idle handler (空闲的cpu时间占比)
wa : time waiting for I/O completion (IO等待的cpu时间占比)
hi : time spent servicing hardware interrupts (硬中断使用cpu时间占比)
si : time spent servicing software interrupts (软中断使用cpu时间占比)
st : time stolen from this vm by the hypervisor (被虚拟化偷走的cpu时间占比)

上面8个指标,和VPS性能相关的主要有两个,我们在选购VPS的时候,可以监视这两个指标:

st,这个指标是针对VPS的,本来属于VPS A的cpu时间,由于超售或者其他原因,cpu时间被其他VPS使用了,VPS A的进程就要等待,st指标就是监测这个等待时间的占比。st的值越小越好,最理想的状态是0%,那么就意味着没人和你抢cpu资源。

wa,这个指标监测的是IO等待占用的cpu时间,可以用来监测IO的性能。比如一个程序运行完成后,要把结果写入到磁盘中,等待写入磁盘完成的时间,就是wa。这个指标只能侧面反映IO的性能,要考虑到vps的真实运行情况,两台vps,运行相同的程序,IO读写量一样,wa相对越小,IO性能相对越好。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>