Free Nano: process burst every 10 minutes, swap jumps with it. What is it? #52591
Replies: 4 comments 1 reply
|
Here is what is happening with the 10-minute process burst and why swap spikes on Nano instances: 1. What runs every 10 minutes and spawns ~650 processes?In Supabase managed Postgres instances, the host runs automated internal platform housekeeping and metric-collection daemons:
2. Why does swap jump on Free/Nano?
3. Can it run less often, and how to optimize?
|
|
One caution about the explanation above: if your "forks" series is the Linux For the next comparison, align memory available, swap-in/out rates (where exposed), CPU and disk I/O, and request latency/errors over the same windows; Supabase documents its Metrics API and Reports. Comparing pool 3 and pool 10 with the same workload, including connection waits and errors, would help distinguish a useful mitigation from a throughput trade-off. Your two pool-3 runs are a useful lead, but not proof of the underlying cause. I cannot determine from these counters which service owns the schedule, its expected memory footprint, or whether customers can tune it; those need confirmation from Supabase. AI-assisted; I have not inspected your project or run your workload. |
|
Same pattern here on two Nano projects. Numbers in the same shape as yours. been casually debugging it for days. Environment: us-west-2, Nano, 408 MB RAM, 1 GB swap, Postgres 17. No clients connected, from /customer/v1/privileged/metrics (2 Dec, UTC), sampled every 61 s. One burst per 10-minute slot, 13 of 13 slots watched, before and after a full restart. Our feed has no forks counter, so CPU is the marker: each burst is about 6 s user and 4 s system. In use: every stall we have a timestamp for (11 so far) began within five minutes after a 10-minute mark. No pg_cron job of ours runs every 10 minutes. At those moments the schema cache load counter did not move and there was no autovacuum or checkpoint. Possible lead: the public supabase/postgres repo sets supabase_admin_agent_timer to on_calendar "*:0/10" in ansible/vars/aws.yml (salt --apply). Is that what this is, and can it run less often on Nano? |
|
Hey @kostiagaracimjvich-arch, hope you're doing well! Your write up is really careful, and the per slot fork table plus the empty Postgres log made this much easier to trace, thank you. Short answer: it's almost certainly Supabase's own configuration agent, BeJames's pointer to the timer is the right lead. Here is the full chain in the public image repo (supabase/postgres, pinned to the current
Why ~650 forks. A Salt apply is one Python process that shells out for most of its checks. Every service state calls Why swap moves with it. As vanshulgoyal101 said, the fork counter counts events, not memory. The forks are just the visible fingerprint. The memory cost is the Salt run itself: a Python runtime loading its modules and state data on a box with about 400 MB of RAM, where Postgres, PostgREST and friends already use most of it. The kernel has to push something to swap to make room, and those pages stay in swap afterwards. BeJames's ~700 MB of disk reads in the burst minute fits that picture of heavy paging. That's also why your pool 3 workaround helps: it doesn't touch the job, it just leaves more room for it. flowchart LR
T["supabase-admin-agent_salt.timer<br/>*:0/10 + up to 30s"] --> S["oneshot service"]
S --> A["supabase-admin-agent<br/>salt --apply"]
A --> C["sudo salt-call<br/>(Python, root)"]
C --> G["grains probes"]
C --> X["systemctl, dpkg, sh<br/>per state"]
C -.-> M["RAM spike on a ~400 MB box<br/>so pages go to swap"]
Your questions 2 and 3 are platform only, and I want to be plain about that rather than guess:
One thing I can't explain from the repo: the timer fires at :x0 plus up to 30 s, but in both your table and BeJames's the burst lands in the sample two to four minutes later. The agent may do its own work before it calls Salt, and a cold Salt start on a box that's already swapping can be slow, but I can't see inside the agent, so that part is a guess. Worth asking support about together with the ticket. What you can do on your side today:
Does this line up with what you see on your test copy and production? And if anyone from the team can confirm the job or share what the agent does before it calls Salt, that would help everyone in this thread. |
Uh oh!
There was an error while loading. Please reload this page.
A small project on Free/Nano shows a process burst about every 10 minutes, and swap jumps with it. I'd like to know what it is.
Environment: eu-west-1, Nano, 406 MB RAM, 1 GB swap. Test copy on image 17.11.0.003, production on 17.6.1.084.
Test copy, no clients connected, from
/customer/v1/privileged/metrics(30 Oct, UTC). Over 125 minutes there were 12 bursts of 636-671 forks, one per 10-minute slot. Other windows stayed at 65 or less.Production, Observability charts only (31 Oct, UTC, pool still 10), CPU about 98% idle at the last point:
Production edge_logs for the last day: 649 requests, 145 over 1 s, 99 with upstream time over 1 s, 3 with more than 1 s in front of upstream. So this does not look like #52011. Some of the 145 are heavy admin RPCs (about 5 s); I haven't separated them.
With 200 simulated users on the test copy, swap above about 400 MB before a burst reached 512 MB every time. Worst run on default settings: p95 40 s, 141 failed of 17,644 requests. PostgREST pool 3 instead of 10 kept swap under 380 MB before bursts in two runs, so I have a workaround.
I can't see the process list. At those moments the schema cache load counter did not move and the Postgres log was empty.
Questions:
I collected the numbers with my own scripts; an AI assistant helped write this post. I can share the full metric dumps.
All reactions