- Arch:
AUR/minq-ananicy-git.
paru -S minq-ananicy-git
oryay -S minq-ananicy-git
should do the trick. Don't forget to start and enable the service by runningsudo systemctl start ananicy.service
andsudo systemctl enable ananicy.service
.
For more information, see here.
More, updated and better organised rules.
Support for cmdline in rules added. This is particularly useful for applications
that share the same name (looking at you, Java). See the freenet
rule as an
example:
{ "name": "java", "cmdlines": ["freenet.node.NodeStarter"], "type": "service" }
This translates to: apply the rule to any process named java
, that received
freenet.node.NodeStarter
as a command line argument. You can add more than one
"cmdlines" in case you want to fine tune your rules.
Ananicy (ANother Auto NICe daemon) — is a shell daemon created to manage processes' IO and CPU priorities, with a community-driven set of rules for popular applications (anyone may add their own rule via GitHub's pull request mechanism). It's mainly for desktop usage.
The current development philosophy is concerned only with usage on desktop (as opposed to server) systems.
I just wanted a tool for auto-setting programs' nice in my system, i.e.:
- Why do I get lag, while compiling kernel and playing games?
- Why does dropbox client eat all my IO?
- Why does torrent/dc client make my laptop run slower?
- ...
Use Ananicy to fix your problems!
X.Y.Z where
X - Major version,
Y - Script version - reset on each major update
Z - Rules version - reset on each script update
Read more about semantic versioning here
To use ananicy you must have systemd installed.
-
On Debian-based distributions
sudo apt -y install systemd
-
You can install ananicy manually with the following commands:
git clone https://github.com/Nefelim4ag/Ananicy.git /tmp/ananicy cd /tmp/ananicy sudo make install
-
Arch: AUR/ananicy-git
yay -S ananicy-git
-
Debian/Ubuntu: Use included script package.sh in repository root directory
git clone https://github.com/Nefelim4ag/Ananicy.git cd Ananicy ./package.sh deb sudo dpkg -i ./tmp/ananicy-*.deb
-
systemd: Enable the background service (Optional)
sudo systemctl enable ananicy sudo systemctl start ananicy
Rules files should be placed under the /etc/ananicy.d/
directory and have
.rules
extensions. Inside the .rules file every process is described in a
separate JSON array; general syntax is described below.
{
"name": "gcc",
"type": "Heavy_CPU",
"nice": 19,
"ioclass": "best-effort",
"ionice": 7,
"cgroup": "cpu90"
}
All fields except name
are optional.
'name' used for matching processes can be found using the PID of any running process (Replace <process> with the name of the executable you wish to create rules for)
basename $(sudo realpath /proc/$(pidof <process>)/exe)
Currently matching by other things is not supported.
You can check what Ananicy does with the command:
ananicy dump proc
Ananicy loads all rules in ram while starting, so to apply rules, you must restart the service.
Available ionice values:
man ionice
CFQ IO Scheduler also uses 'nice' for internal scheduling, so it's mean processes with same IO class and IO priority, but with different niceness will take advantages of 'nice' also for IO.
- Try don't chage 'nice' of system wide process like initrd.
- Please try use full process name (or name with ^$ symbols like NAME=^full_name$)
- When writing rules - try to only use 'nice', it must be enough in most cases.
- Don't try to set high priorities! Niceness can fix some performance problems, but can give you more, too, if you let it. Example: pulseaudio uses 'nice' -11 by default, if you set other cpu hungry task, with 'nice' {-20..-12} you can catch a sound glitches.
- For a CPU-hungry background task like compiling, just use NICE=19.
About IO priority:
- It's usefull use '{"ioclass": "idle"}' for IO hungry background tasks like: file indexers, Cloud Clients, Backups and etc.
- It's not cool to set realtime to all tasks. The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. Try to use ioclass first.
Get ananicy output with journalctl:
$ journalctl -efu ananicy.service
If you see this error in the output
Jan 24 09:44:18 tony-dev ananicy[13783]: ERRO: Missing schedtool! Abort!
Fix it in Ubuntu with
sudo apt install schedtool
Please use pull requests. Thank you.