Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
Assigneeszack

Relationships

#5232 swamp serve's scheduler polls its datastore ~19x/s while idle (~2% CPU for one daily schedule)

Opened by ascandroli · 11/30/2026

With the scheduler on, an idle swamp serve reads its SQLite stores about 19 times a second and spends about 2.2% of a CPU core, even with a single schedule that fires once a day. With --no-schedule the same serve is idle. The docs describe the scheduler as cron entries plus a filesystem watcher, so this looks unintended.

Version: swamp 20261127.024011.0-sha.2d6f287a, Linux x86_64 (container), swamp serve --dashboard --config serve.yaml --auth-mode token; serve.yaml sets a local audit store and nothing schedule-specific.

Measurement: two throwaway serves on the same repo and config, 60 s each after a 20 s warm-up, no HTTP clients connected, counters from /proc/<pid>/io and /proc/<pid>/stat. --no-schedule: 48 read syscalls, 19 KB, 0 s CPU per minute. Scheduler on, one schedule 15 7 * * *: 1,145 read syscalls, 6.1 MB, 1.33 s CPU per minute. The long-running serve matches (about 16 GB read in 42 hours, all on the main thread). Open files: .swamp/data/_catalog.db, .swamp/run_tracker.db, .swamp/_extension_catalog.db and their -wal/-shm. Turning the audit log off does not change it.

Expected: between fires an idle scheduler sleeps until the next cron slot (and wakes on the workflow watcher), with no periodic datastore reads.

Why it matters: on a small always-on host it is one of the larger idle consumers; the workaround, --no-schedule with an external scheduler calling a webhook route, loses the dashboard's schedule view, lastMissed and schedule pause.

02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED+ 1 MOREASSIGNED

Open

11/30/2026, 11:51:16 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/30/2026, 2:44:46 PM
Editable. Press Enter to edit.

ascandroli commented 11/30/2026, 12:35:55 PM

Two more findings (swamp 20261127.024011.0-sha.2d6f287a):

  1. The polling does not depend on having schedules. After removing the only workflow trigger, serve logged Unregistered schedule for workflow "backup-status", and the same serve still made 912 read syscalls and used 1.16 s of CPU in the next 60 s. Only --no-schedule stops it.
  2. --no-schedule has no config equivalent. no-schedule: true in serve.yaml logs Unknown key "no-schedule" in serve config file … — ignoring, and SWAMP_NO_SCHEDULE=1 is not read either (serve still logs Boot: starting scheduler). swamp serve check-config passes the file with the unknown key, so a typo there is silent. A serve.yaml key (or env var) would let a service unit turn the scheduler off without editing its command line.

zack commented 11/30/2026, 3:19:05 PM

Thanks for the careful A/B measurement. We haven't been able to reproduce this yet, and we'd like your help finding what differs.

We ran the same release (20261127.024011.0-sha.2d6f287a) from the published Docker image, with the dashboard, token auth, a local audit store, 12 workflows, some run history and one 15 7 * * * schedule. Telemetry was off. Over 60 idle seconds:

Reads Bytes CPU
Scheduler on 124–130 91 KB about 0.2 s
--no-schedule 78 90 KB about 0.2 s

An strace of the scheduler-on run showed no SQLite reads while idle, so something in your setup is likely involved.

Most useful: which files are being read. With the scheduler on and serve idle:

timeout 60 strace -f -tt -y -s 0 -e trace=read,pread64,openat -o serve.strace -p <serve pid>

-s 0 leaves file contents out, but file paths remain, so please check it before sharing. The swamp image doesn't include strace. You can run it as root on the Docker host using the host's PID for serve, or from a container started with --pid=container:<name> --cap-add SYS_PTRACE.

If strace isn't possible, run this in the serve container before and after 60 idle seconds:

for t in /proc/<serve pid>/task/*; do echo "$(basename $t) $(cat $t/comm) $(grep -E '^(syscr|rchar)' $t/io | tr '\n' ' ')"; done

A few questions:

  1. Does the serve log repeat "Registered schedule for workflow" or "Unregistered schedule for workflow" while idle?
  2. What are the host OS and container runtime, and is the repo on a bind mount, a named volume or the image's own filesystem? Inside the container, uname -a and findmnt -T <repo>/workflows would help.
  3. How large are .swamp/data/_catalog.db and .swamp/run_tracker.db, including their -wal files? Roughly how many workflows and past runs are there?
  4. Could you share .swamp.yaml and serve.yaml with secrets removed, and list your pulled extensions?
  5. Was the long-running serve, or any other swamp process, using the same repo during the A/B test?
  6. Does a fresh repo with one daily schedule show the same thing in that container?

If you only have time for one, the strace is the most valuable, followed by question 1.

Sign in to post a ripple.