CentrioHost Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog

How to use CPULimit on CentOS 7

Are you looking to restrict the CPU utilization of a particular process or application on your Linux server? CPULimit is a tool in Linux that is used to limit the CPU usage of a process. It prevents an application from utilizing a whole core for a considerable period. Every application running on a PC uses up the processor’s power and if eventually many applications are used together they can slow down a computer by using too much processor power thus, CPULimit can be used to limit this usage, and prevent excessive power use of the processor.

Requirements for CPULimit Installation 

There are mainly 3 requirements for installing CPULimit. Firstly, a 64bit server that can run CentOS 7 is needed (we will be using a CentOS 7 based server in this tutorial). Secondly, sudo or root access is required. And finally make, screen, and wget are required, so please have these installed on your server before proceeding further.

How to install CPULimit

 The installation process is as follows:

1. The first step involves the extraction of tarball after downloading of CPULimit:

cd ~
wget https://astuteinternet.dl.sourceforge.net/project/limitcpu/limitcpu/cpulimit-2.5.tar.gz
tar -xvf cpulimit-2.5.tar.gz

2. The next step includes entering the directory created in step 1:

cd cpulimit-2.5

3. For the compilation of CPULimit into Binary usage of make is done next:


4. 3rd step makes a binary available in the cpulimit-2.5 directory. For the completion of the installation process the final command is as such:

make install

Working principle of CPULimit

The basic working principle of CPULimit is to quickly terminate or start the applications so that CPU usage can be limited to a smaller number of cycles. However, the applications that can be terminated when a stop signal:  (SIGSTOP) is sent, should not be worked with CPULimit.

How to configure CPULimit

The next thing we need to know about is the PID (i.e. Process ID). This can be done by utilizing the “top” command:
top –c 

The running processes should now be displayed, for example below:

Tasks: 130 total,   1 running, 129 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.0 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3881740 total,   191952 free,   413472 used,  3276316 buff/cache
KiB Swap:  4063228 total,  4062912 free,   316 used.  2881364 avail 
1336 plex   35  15 1368172  67464   6668 S   0.3  1.7 155:41.58 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-995f1dead+
31345 root   20   0  326572  21844  12784 S   0.3  0.6  86:45.32 docker-containerd --config  /var/run/docker/containerd/containerd.toml 
1 root   20   0  193704   6744   4088 S   0.0  0.2   6:49.22 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 
2 root   20   0      0 S   0.0  0.0   0:01.45 [kthreadd] 
3 root   20   0      0 S   0.0  0.0   0:12.77 [ksoftirqd/0] 
5 root    0 -20      0 S   0.0  0.0   0:00.00 [kworker/0:0H] 
7 root   rt   0      0 S   0.0  0.0   0:13.95 [migration/0]  

Now in the above example – let’s say Plex needs to be limited to 10% CPU utilization. You will want to run the command in screen as follows:

screen -S limitcpucpulimit -p 1336 -l 10  

Ctrl+A+D command can be used to leave the screen.

Overall, the following code is used as the format for CPULimit:

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

Do you use cpulimit in your environment? We would love to hear your comments below!

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar


Over 20000 Satisfied Customers!

  • web hosting reviewer
    Valerie Quinn
    CTO, Acteon Group

    Centriohost staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue! ~ . . . Read more

  • Joomla hosting reviewer
    Collin Bryan
    Photographer, Allister Freeman

    I'm using centrio for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly. ~ . . . Read more

  • dedicated server reviewer
    Harry Collett
    Actor, A&J Artists

    Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all. ~ . . . Read more

  • vps web hosting reviewer
    Porfirio Santos
    Technician, Diageo PLC

    Centrio support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Centriohost have been amazingly responsive and helpful to any of my queries 👍👍👍 ~ . . . Read more

  • wordpress hosting plans reviewer
    Catherine Auer
    Doctor, SmartClinics

    Anytime I've had a problem I can't solve, I've found Centriohost to be diligent and persistent. They simply won't let an issue go until the client is happy. ~ . . . Read more

  • reseller hosting reviewer
    Effectivo Social
    Freelancer, Fiverr

    Recommend their shared hosting for all my SME web design clients. Their cloud or VME offerings are too great to deal with. Pricing is perfect and suitable for all users (͠≖ ͜ʖ͠≖) 👌 ~ . . . Read more