最新消息:

CPU C-states 影响和监测

未分类 admin 16258浏览 0评论

最近有同事反馈,R510在使用新内存后,较高频率出现内存报错.经排查是BIOS和CPU c-states休眠选项配合兼容出现问题,已在最新BIOS中解决.本文主要说下c-states的作用.

NewImage

CPU’s States三兄弟

CPU operating states (C-states)
CPU performance states (P-states)
CPU Throttling States(T-states)
三个states引入来共同自动处理CPU节能.其中P-states更改主频率,T-states更改单位时间Clock On的比例;在实际运维中影响较大,我们都默认关闭.
顺便提下turbo功能,如果p-state被启用,除了低负载时降频之外,高负载时,允许一定条件和时间内,主频冲高来应对短暂高峰

CPU电源状态

C-states则是修改CPU的电源状态,逐级部分功能休眠来减少资源消耗.主要的状态如下:
C0 – Active: CPU is on. C0 is the operating state.
C1 – Auto Halt: core clock is off. C1 is a state where the processor is not executing instructions, but can return to an executing state essentially instantaneously. Some processors also support an Enhanced C1 state (C1E) for lower power consumption.
C2 – Stop Clock: core and bus clocks are off. C2 is a state where the processor maintains all software-visible state, but may take longer to wake up.
C3 – Deep Sleep: clock generator is off. C3 is a state where the processor does not need to keep its cache coherent, but maintains other states. Some processors have variations on the C3 state (Deep Sleep, Deeper Sleep, etc.) that differ in how long it takes to wake the processor.
C4 – Deeper Sleep: reduced VCC
DC4 – Deeper C4 Sleep: further reduced VCC

使用建议

我们看到,CPU的部分功能逐级关闭,节能更多,但跨度越大,唤醒的成本也会提高.
IBM和DELL厂家建议对于绝大多数业务场景,C-States都应该被默认打开,它可以很好的节能;但在极端条件如CPU-Bound,或业务抖动性相当高的场景下,可以将C-states关闭,以使CPU时刻处在C0状态,可以最大限度处理请求,减少状态变化带来的损耗.关闭可以在BIOS中设置,最新的内核也有相关参数intel_idle.max_cstate=0.

监测当前CPU模式

怎么去看线上服务器CPU处在哪级工作模式呢?
可以使用i7z小工具https://code.google.com/p/i7z/ 解压make后直接使用,我们找了三台不同的服务器来看区别
1.新机型压测DB.CPU时间绝大多数都在C0

NewImage3

2.主库,Core1的20%处于C0状态,可见DB确实是个非CPU-Bound的应用

NewImage1

3.备库,C0状态更少了,在非dump,非failover时间,备库在保证同步的前提下,主要做的是:节能,节能,节能!

NewImage2

i7z这个工具很不错,同时向下兼容i5,i3处理器,可以拿来看看各种应用~

refrence:

https://access.redhat.com/knowledge/solutions/202743

Disable C-State, Why That?

http://blog.csdn.net/hgf1011/article/details/5897729

转载请注明:爱开源 » CPU C-states 影响和监测

您必须 登录 才能发表评论!