1

I want to limit CPU and memory usage for PHP-FPM and Nginx processes in CentOS. I came across following tools

  • cpulimit
  • cggroups
  • memory resource locater

which will more efficient and how can I configure for limiting resources for PHP-FPM and Nginx processes ?

1 Answer 1

6

I think "cpulimit" is best way to control cpu usage per process. cpulimit does not act on the nice value or other scheduling priority stuff, but on the real cpu usage.

cpulimit

Install cpulimit on Linux:

yum install cpulimit

To limit CPU usage of the process called nginx to 40%, enter:

cpulimit -e nginx -l 40

To limit CPU usage of the process to 40% by using its PID, enter:

cpulimit -p 3302 -l 40

Where,

-p : Process PID. -e : Process name. -l : percentage of CPU allowed from 0 to 100. -P: absolute path name of the executable program file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .