paru -S minq-ananicy-git
or yay -S minq-ananicy-git
should do the trick. Don't forget to start and enable the service by running sudo systemctl start ananicy.service
and sudo systemctl enable ananicy.service
.For more information click 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 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.
I just wanted a tool for auto set programs nice in my system, i.e.:
Use ananicy to fix these 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.
You can install ananicy manually by:
$ git clone https://github.com/Nefelim4ag/Ananicy.git /tmp/ananicy
$ cd /tmp/ananicy
$ sudo make install
$ git clone https://github.com/Nefelim4ag/Ananicy.git
$ ./Ananicy/package.sh debian
$ sudo dpkg -i ./Ananicy/ananicy-*.deb
Enable
$ sudo systemctl enable ananicy
$ sudo systemctl start ananicy
Rules files should be placed under /etc/ananicy.d/
directory and have *.rules
extension.
Inside .rules file every process is described on a separate line. 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 match processes by exec bin name
~ basename $(sudo realpath /proc/1/exe)
systemd
Currently matching by other things is not supported.
You can check what Ananicy sees, by:
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 Scheduller also uses nice
for internal scheduling, so it's mean processes with same IO class and IO priority, but with different nicceness will take advantages of nice
also for IO.
nice
of system wide process like initrd.^$
symbols like NAME=^full_name$
)nice
, it must be enough in most cases.nice
-11 by default, if you set other cpu hungry task, with nice
{-20..-12} you can catch a sound glitches.NICE=19
.About IO priority:
{"ioclass": "idle"}
for IO hungry background tasks like: file indexers, Cloud Clients, Backups and etc.Get ananicy output with journalctl:
$ journalctl -efu ananicy.service
schedtool
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 request, thanks