RHEL/Centos: How to add CPU governors and change CPU frequency on servers ?

Today we will look at an interesting article where we will see how to increase CPU frequency on a redhat server.

I encountered this issue where we have two identical servers and one of them is working slow.

The DB query which takes 2 hours on one node is consuming long 12 hours on another node.

Later i found that the slow server is running with 1.2GHz clock frequency, and the other server is running with clock frequency of 2.2GHz which answers why it has slow speed.

And the server has 144 CPUs, so you can imagine the performance difference if 144 CPUs are running on 1.2GHz vs 2.2 GHz.

1. First we have checked the frequency info on both of the servers.
I. First Server

    [root@ngelinux001 ~]# cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us
  hardware limits: 1.20 GHz - 2.20 GHz
  available frequency steps:  2.20 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
  available cpufreq governors: conservative userspace powersave ondemand performance
  current policy: frequency should be within 1.20 GHz and 2.20 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: 2.20 GHz (asserted by call to hardware)
  boost state support:
    Supported: yes
    Active: yes

II. Second Server

    [root@ngelinux001 ~]# cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 1.20 GHz - 3.00 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 1.20 GHz and 2.20 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: 1.20 GHz (asserted by call to hardware)
  boost state support:
    Supported: yes
    Active: yes

 

2. To increase the performance on server, we have to enable the performance governer.
Hence we have used below command as we have RHEL 7.

# tuned-adm profile latency-performance

 

3. For RHEL 6, we can use below command.

# processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll

 

4. For RHEL 5, we need to add the performance parameter to /etc/sysconfig/cpuspeed, and in end restart the cpuspeed service

### Add below in /etc/sysconfig/cpuspeed
GOVERNOR=performance

### Now restart the cpuspeed service.
service cpuspeed restart

 

5. For older versions than RHEL 5, we can configure cpu speed to run at maximum speed at all times by adding below parameter in /etc/cpuspeed.conf and then restart cpuspeed service.

### Add below in /etc/cpuspeed.conf
OPTS="$OPTS -n -C -S \\"0 1\\""

### Now restart cpuspeed service
service cpuspeed restart

Leave a Reply

Your email address will not be published.