From 045582798911d959c819f3d3a294d8604426b0b7 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Tue, 19 Sep 2017 20:42:07 +0200 Subject: [PATCH] Adjust CPU and IO shares when running under systemd Let's remove the CPUQuota example and instead give bees a share of what's available. 128 CPU shares will give it about 12% max CPU under load, give it a slight boost during startup to allow reading the hash table faster. 100 block shares will give it about 10% max disk bandwidht under load, give it a slight boost during startup to allow reading the hash table faster. Then let's adjust the CPU and IO scheduler to prefer other processes. This way bees runs completely in the background, barely noticable during, e.g., gaming. --- scripts/beesd@.service | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/beesd@.service b/scripts/beesd@.service index 54fc187..55df99c 100644 --- a/scripts/beesd@.service +++ b/scripts/beesd@.service @@ -8,11 +8,17 @@ ExecStart=/usr/sbin/beesd %i Nice=19 KillMode=control-group KillSignal=SIGTERM +CPUShares=128 +StartupCPUShares=256 +BlockIOWeight=100 +StartupBlockIOWeight=250 IOSchedulingClass=idle +IOSchedulingPriority=7 +CPUSchedulingPolicy=batch +Nice=19 Restart=on-abnormal CPUAccounting=true MemoryAccounting=true -# CPUQuota=95% [Install] WantedBy=local-fs.target