Limiting certain processes to CPU % – Linux

I had a slightly similar issue with gzip.

Assuming we want to decrease the CPU of a gzip process:

    gzip backup.tar & sleep 2 & cpulimit --limit 10 -e gzip -z

Options:

  • I found sleep useful as the cpulimit sometimes didn’t pick up the new gzip process immediately
  • --limit 10 limits gzip CPU usage to 10%
  • -z automatically closes cpulimit when gzip process finishes

Another option is to run the cpulimit daemon.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)