authoravatarclover caruso<git@paperclover.net>2026-10-23 18:14:26-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-24 19:01:23-07:00
log98cae3f5303586df4613ce13f6456f86e5a12bf6
tree233249cd5a7688636b650974b74a1a57ee4e5fd6
parentab54eeca0df96c59724bf78d5491bfe87b1a677d
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Keep the Knife server and its database responsive under load

The container's 12-core quota ran out every period, freezing the Knife server with the builds, and reclaim had shrunk the ARC to 6 GiB, so its state database was read from the HDDs on the main thread. Assisted-by: claude-opus-5.5

3 files changed, 6 insertions(+), 2 deletions(-)

nixos/knife-linux.nix+2-1
......@@ -38,7 +38,8 @@ in
3838 run "run --rm --replace --name=knife-linux --pull=never"
3939 "--sdnotify=conmon --cgroups=no-conmon --log-driver=journald --init --hostname=knife-linux"
4040 "--user=${uid}:${gid} --umask=0077 --cap-drop=ALL --security-opt=no-new-privileges"
41 "--memory=32g --cpus=12 --pids-limit=32768 --shm-size=2g --network=podman"
41 # A low weight rather than a CPU quota: an exhausted quota freezes the Knife server too.
42 "--memory=32g --cpu-shares=1024 --pids-limit=32768 --shm-size=2g --network=podman"
4243 "--volume=${root}/home:/home/clo"
4344 "--volume=${sandbox}:/Volumes/Code"
4445 "--volume=/opt/studio-project-store/current/bin/jj-real:/usr/local/bin/jj:ro"
nixos/zfs-read-cache.nix+3
......@@ -6,6 +6,9 @@ let
66 headroom = 32 * 1024 * 1024 * 1024;
77in
88{
9 # Reclaim pressure otherwise shrinks the ARC to a few GiB with most memory free.
10 boot.kernelParams = [ "zfs.zfs_arc_min=${toString (32 * 1024 * 1024 * 1024)}" ];
11
912 systemd.services.snowglobe-zfs-read-cache = {
1013 wantedBy = [ "multi-user.target" ];
1114 after = [ "zfs-import-${pool}.service" ];
tools/knife-linux.md+1-1
......@@ -4,7 +4,7 @@
44agents directly beside ZFS. [knife-linux.nix](../nixos/knife-linux.nix) builds it
55from [knife-linux.Containerfile](../nixos/knife-linux.Containerfile) on each start
66and runs it as the `knife-linux` system service: uid 3000 (`clo`), no
7capabilities, 12 CPUs, a 32 GiB memory limit, `/dev/kvm`, and Podman's NAT network.
7capabilities, a low CPU weight with no core cap, a 32 GiB memory limit, `/dev/kvm`, and Podman's NAT network.
88Knife listens on container loopback port 3773; devices reach it through the mesh
99as `snowglobe` (device `4b85ee48…`). User namespaces work inside, but Podman's
1010seccomp filter blocks the `chroot` Chromium-based sandboxes need, so Chromium,