Compare commits

...
2 Commits
Author SHA1 Message Date
patrick 9a5ee5610b Merge pull request 'Stop kernelwatch-apt-update starving for disk on busy hosts' (#34) from fix/apt-update-io-priority into main
CI / tests (Python 3.11) (push) Successful in 42s
CI / tests (Python 3.10) (push) Successful in 42s
CI / tests (Python 3.12) (push) Successful in 43s
CI / tests (Python 3.13) (push) Successful in 42s
CI / lint (push) Successful in 4s
Reviewed-on: #34
2026-11-08 20:49:17 +00:00
patrickandClaude Opus 5.5 f314fa331e Stop kernelwatch-apt-update starving for disk on busy hosts
CI / tests (Python 3.10) (pull_request) Successful in 43s
CI / tests (Python 3.11) (pull_request) Successful in 43s
CI / tests (Python 3.12) (pull_request) Successful in 43s
CI / tests (Python 3.13) (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 3s
On nike (I/O pressure "full" around 86%), kernelwatch-apt-update.service
timed out after 5 minutes every run. The downloads were quick, but apt
then spent the rest of the time reading and writing its lists. At normal
priority the same apt-get update took 1m31s.

The unit ran in the idle I/O class, which gets disk time only when
nothing else wants it, so under constant I/O apt got almost none. It now
uses the lowest best-effort priority (IOSchedulingPriority=7). That still
yields to everything else on the host, but apt can't be starved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:46:44 -05:00
2 changed files with 12 additions and 1 deletions

No files matched your search

+5 -1
View File
@@ -27,8 +27,12 @@ RuntimeDirectoryMode=0755
RuntimeDirectoryPreserve=yes RuntimeDirectoryPreserve=yes
UMask=0022 UMask=0022
TimeoutStartSec=5min TimeoutStartSec=5min
# Lowest best-effort disk priority, not the idle class: idle gets disk time only
# when nothing else wants it, so on a host with constant I/O apt waits on
# reading and writing its lists until the timeout kills it, every run.
Nice=10 Nice=10
IOSchedulingClass=idle IOSchedulingClass=best-effort
IOSchedulingPriority=7
# apt needs root to write /var/lib/apt and drops to _apt for downloads, so this # apt needs root to write /var/lib/apt and drops to _apt for downloads, so this
# runs as root (the default) but loses everything apt update doesn't touch. # runs as root (the default) but loses everything apt update doesn't touch.
+7
View File
@@ -327,6 +327,13 @@ class PackagingTest(unittest.TestCase):
unit = self.read("kernelwatch-apt-update.service") unit = self.read("kernelwatch-apt-update.service")
self.assertNotRegex(unit, r"(?m)^(User|DynamicUser)=") self.assertNotRegex(unit, r"(?m)^(User|DynamicUser)=")
def test_apt_update_disk_priority_cant_be_starved(self):
# The idle class gets no disk time while anything else does I/O, so on a busy
# host apt never finished inside TimeoutStartSec.
unit = self.read("kernelwatch-apt-update.service")
self.assertNotRegex(unit, r"(?m)^IOSchedulingClass=(idle|3)\s*$")
self.assertIn("\nIOSchedulingClass=best-effort\n", unit)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()