How to disable/enable CPUs in Linux ?

It's quite interesting to know how to disable and enable CPU core in Linux in different scenario.

Thought came from Exadata architecture as Exadata 1/8th Rack comes with 16 cores but only half of the CPUs will be enabled on the DB server, that's why we have to pay Oracle licence cost for half core only.

This enabling and disabling can be controlled by resource control utility which comes with Exadata, so what we can do to enable or disable cpu core in non Exadata server?

We have performed this test on test server which has four CPU cores.

Step 1: Check Total Available CPU

There are multiple method to check it, we have checked it with TOP utility which give you better understanding. It shows 4 cpu cores are available.

Step 2 : Disable CPU

Directory path to see available CPU devices.

#cd /sys/devices/system/cpu

Execute Linux command "echo 0 > /sys/devices/system/cpu/cpu3/online" to disable CPU core.

Step 3 : Verify whether CPU has been disabled or not by executing TOP utility

Step 4 :  Enable CPU which we have disabled in step-2

Execute Linux Command "echo 1 > /sys/devices/system/cpu/cpu3/online" to enable CPU core

Step 5 : Check the status of enabled CPUs

This activity doesn't require downtime. Hope this article will help you.

No comments:

Post a Comment