Vahid
September 23rd, 2010, 07:57
چند روز پیش مجبور بودم نزدیگ به 900 گیگ فایل رو زیپ کنم روی یه لینوکسی که کرش کرده بود و وقتی میرفت زیر بار ریستارت میشد چون وقتی دستور زیپ رو ران میکردم تمام CPU پر میشد یعنی 100 و به 1 دقیقه نمیکشید که سرور ریستارت میشد . وقتی توی نت سرچ ردم نمیدونم بگم اسکریپت برنامه به هر حال برنامه ایی رو پیدا کردم که یه دستور یا یک PID خاص رو محدودید CPU روش میزاشت که اون هم CPULIMIT (http://cpulimit.sourceforge.net/)بود .
طریقه نصب :
wget Download CPU Usage Limiter for Linux from SourceForge.net (http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz)
tar -xvf cpulimit-1.1.tar.gz
cd cpulimit-1.1
make
بعد اینکه نصب کردید دستور cpulimit رو در /usr/bin قرار بدید
mv cpulimit /usr/bin/
بعد که دستور CPULIMIT رو بزنید :
[
root@d8 ~]# cpulimit --help
Usage: cpulimit TARGET [OPTIONS...]
TARGET must be exactly one of these:
-p, --pid=N pid of the process
-e, --exe=FILE name of the executable program file
-P, --path=PATH absolute path name of the executable program file
OPTIONS
-l, --limit=N percentage of cpu allowed from 0 to 100 (mandatory)
-v, --verbose show control statistics
-z, --lazy exit if there is no suitable target process, or if it dies
-h, --help display this help and exit
[root@d8 ~]#
حالا برای محدود کردن یه پید خاص :
# cpulimit -p 7332 -l 60
عدد 55 بالاترین درصدی هست که میتونه این پید داشته باشه و 7332 شماره پید هست
برای محدود کردن یه دستور خاص :
cpulimit --exe /usr/local/bin/bigloop --limit 40
طریقه نصب :
wget Download CPU Usage Limiter for Linux from SourceForge.net (http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz)
tar -xvf cpulimit-1.1.tar.gz
cd cpulimit-1.1
make
بعد اینکه نصب کردید دستور cpulimit رو در /usr/bin قرار بدید
mv cpulimit /usr/bin/
بعد که دستور CPULIMIT رو بزنید :
[
root@d8 ~]# cpulimit --help
Usage: cpulimit TARGET [OPTIONS...]
TARGET must be exactly one of these:
-p, --pid=N pid of the process
-e, --exe=FILE name of the executable program file
-P, --path=PATH absolute path name of the executable program file
OPTIONS
-l, --limit=N percentage of cpu allowed from 0 to 100 (mandatory)
-v, --verbose show control statistics
-z, --lazy exit if there is no suitable target process, or if it dies
-h, --help display this help and exit
[root@d8 ~]#
حالا برای محدود کردن یه پید خاص :
# cpulimit -p 7332 -l 60
عدد 55 بالاترین درصدی هست که میتونه این پید داشته باشه و 7332 شماره پید هست
برای محدود کردن یه دستور خاص :
cpulimit --exe /usr/local/bin/bigloop --limit 40