How to Install and Use CPULimit on CentOS

CPULimit is a utility designed to work with Linux servers to limit the use of resources by an application. Cpulimit is used to limit the CPU usage of a process in the same way as CPUTool, however it offers more use cases than its counterpart. One of the important differences is that cpulimit does not manage system boot, unlike cputool. It works as follows: CPULimit is not designed to work with applications that use job control, for example; as they can be destroyed when CPULimit sends the SIGSTOP stop signal. Essentially, applications will turn on or off quickly enough to limit the program to the desired number of cycles. It is worth noting here that most applications will run normally. Some applications that may be limited include Nginx, PHP, Java.

CPULimit Installation Process

To quickly and successfully install this utility, you need make, screen, and wget. Then you need to install and, therefore, unpack the archive:

cd ~
tar -xvf cpulimit-2.5.tar.gz

The next step is to run make to start compiling CPULimit:

cd cpulimit-2.5

The next step is to run make to start compiling CPULimit:


When this process completes, a binary file will appear in the cpulimit-2.5 directory. In order for it to be available for the entire system, we will need to run the following command:

make install

Configuring CPULimit Using the Application

By entering the special top command it is possible to view the list of processes. They will look something like this

In order to close this display screen, you need to use the following combination: CTRL + A + D. And in order to enter again you can follow the following command:

screen -r limitcpu

The general format for running cpulimit looks like this:

cpulimit -p (PROCESS PID) -l (CPU %)

Was this article helpful?

Related Articles

Leave A Comment?