How can I limit the processor usage limit for the copying process when it is running? My friend and I are planning to get a PC to host servers and we need to know how to limit this usage to the copying process because last time we did a host machine, every time we were copying new files the servers were starting to lag.
migrated from stackoverflow.com Aug 11 '12 at 19:48
Use
|
|
There also is schedtool, which sets general scheduler policy (including I/O). – grawity Aug 11 '12 at 20:47 |
||
do you have to repeat the nice ionice combination if you use piped commands, e.g. nice -n19 ionice -c3 grep xyz | grep zzz ? Is grep zzz also niced or do you have to repeat the nice ionice in front of the grep zzz, means nice -n19 ionice -c3 grep xyz | nice -n19 ionice -c3 grep zzz ? – bzero Aug 15 '12 at 6:18 |
|||
@bzero nice and ionice propagate to subshells, so you'd need to (io)nice the PPID or enclose your pipelines in (...) or {...;} if you want that to work. – CodeGnome Aug 15 '12 at 13:12 |
|||
No, you can only do something like (renice -n 19 -p $BASHPID; ionice -c 3 -p $BASHPID; foo | bar) or nice -n 19 ionice -c 3 bash -c "foo | bar". (Note that { ...; } doesn't actually run a subshell.) – grawity Aug 24 '12 at 1:02 |
|
Copying has very little CPU impact, the resource it uses is IO bandwidth. You should prefix io-intensive commands with |
|||
|
|
cpprocess itself. And the fs work is going to be system usage, not user. – Jon Lin Aug 11 '12 at 19:33