You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to Limit CPU Usage for a Service?

Applies to: 

Linux OS – OL7 and later 

Linux x86-64 

 

Question: 

How to limit CPU usage by a service and make it persist across reboots.


Answer:

Solution 1: 

Use the ‘systemctl set-property’ command. You can set the CPUQuota property within the systemd service unit file or using the command line as follows: 

$ sudo systemctl set-property SERVICE_NAME.service CPUQuota=10% 

NOTE: Replace SERVICE_NAME with the name of your service. 

The above command will set the CPUQuota property for the specified service and restrict its CPU usage to 10%. The configuration will persist across reboots because it is applied to the systemd service unit file. 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!