Priority Queue on Linux Servers¶
We can set priorities for Linux commands using nice and renice commands and by setting the processes PR (priority value)
There is a more in depth guide for niceness HERE.
We will sometimes need to update the priority queue for long-running processes that are time sensitive or processes we would prefer to have finish faster.
nice is a number range from -20 to +19, the lower the higher priority, that determines a
This number is set to 0 by default for new processes and all processes
with the same priority are grouped together and run sequentially.
You can run a command while setting the
nice -n niceness-value command args
nice -n -20 bin/magento s:s:d -f -j4 en_US en_GB
We can also adjust niceness value of a pre queued process using the
This can be done using either the process id (PID) or using the user id
- Using PID
renice -n -20 -p 1000
- Using UID
renice -n -20 -u root
Setting default values¶
Default nice values can be set in
The syntax is:
#<domain> <type> <item> <value>
<username> <hard|soft> priority <nice value>
ec hard priority -20
You can get more information on these functions using
If when checking processes using HTOP you think that a process is running slowly, you can dynamically update the nice value using HTOP.
To increase the priority you can use F7 to minus the nice value.