چرا امکان پذیر هست .میتونید از نرم افزار کوچک cpulimit استفاده کنید
برای نصب و استفاده مراحل زیر را دنبال کنید:
نصب :
برای نحوه استفاده از نرم افزار میتونید به راهنما مراجعه کنید :
کد:
[root@localhost cpulimit-1.1]# ./cpulimit -h
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
مثال :
گذاشتن محدودیت استفاده از حداکثر ۴۰ درصد cpu برای mysqld
کد:
[root@localhost cpulimit-1.1]# ./cpulimit -e mysqld -l 40
Warning: no target process found. Waiting for it...
Process 9536 detected
نکته ۱ :اگر لیمیتتون خیلی زیاد باشه نرم افزارتون سریع هنگ میکنه
نکته ۲: لیمیت ۱۰۰ فقز برای یک هسته cpu هست , اگر بیشتر از 1 هسته cpu دارید هرکدام را باید 100 در نظر یگیرید . برای مثال سروری که ۴ هسته cpu دارد نهایت توانش ۴۰۰ هست.
موفق باشید