Skip to content

Measure prod memory, swap and CPU for 7 days before any compute change #324

Open

Description

@HMarzban

Key: SPR-17 · Type: HITL · Part of: #327 · Blocked by: #755 pushed, 24 h guard clean · Checked against: 0b302b2 (2026-11-11)

Problem

Compute size is the only thing that changes our Supabase bill, and nobody has ever measured prod memory, swap or CPU. The July 2026 audit estimated 70-90% RAM use on the Small size. That number is a guess, not a reading. This issue collects 7 days of host metrics from the Supabase dashboard. It ends with one recorded ruling on this issue: keep, upsize or (later) downsize.

This is an evidence issue. Its number is the measured memory and swap, which replaces the July 70-90 % estimate.

Until this ruling exists, nobody may propose a compute change. That includes the "downgrade to Micro" idea on the #326 do-not-do list.

This issue covers the Supabase project only (Postgres 15.8, before #322). The collab database is a separate cluster, and it moved to London on 2026-11-11.

Benchmark

Field Value
Metric Daily max memory used, % of MemTotal. Daily max swap used, %. Daily max host CPU busy, %
Before 0 measured days. The 70-90 % RAM figure is a July 2026 estimate
After Not measured yet
Condition Production Supabase project (Postgres 15.8, not the collab database). 7 consecutive UTC days. No #322 upgrade, compute change or project restart in the window. No #748 supabase-db dump in the window. Record any #747 cutover day in the Events column. Compute size read from the dashboard and matched to max_connections
How to run Steps 3 and 4: the Database Health chart's daily max for each UTC day is the rule input. Set the time picker to that one UTC day (24 h), so bucket averages do not hide peaks
Pass rule Apply the step 5 table to the 7 daily rows. Keep the size if swap is at or under 70 % on 6 or more days. Upsize if swap is above 70 % on 2 or more days. File a CPU issue if CPU is above 80 % on 3 or more days. If upsized: swap under 70 % for 24 h after the change
Guard The window starts on the day of the #325 reset, and ends before #322 starts
Owner Maintainer, every step
Claim None for marketing. Internal: "Compute size ruled on 7 days of measured host data, not an estimate."

Context

Tags: [prod] measured on prod · [docs] Supabase documentation, checked 2026-09-28 · [pred] inferred or estimated, not measured.

How Supabase bills compute [docs]. "You are charged for the Compute resources of that server, independent of your database usage." Source: https://supabase.com/docs/guides/platform/manage-your-usage/compute. So query tuning saves $0. Only the size changes the bill.

Size Memory CPU Max direct connections Price per month [docs]
Micro 1 GB Shared 60 about $10
Small 2 GB Shared 90 about $15
Medium 4 GB Shared 120 about $60
  • Paid plans include $10 a month in compute credits, not carried over [docs]. If prod is the only project using them, Small costs about $5 net and Micro about $0.
  • "Compute instance changes are usually applied with less than 2 minutes of downtime, but can take longer depending on the underlying Cloud Provider." [docs] Source: https://supabase.com/docs/guides/platform/compute-and-disk.

What we know about prod (project tglymsfloxmouzjuoycu, Postgres 15.8.1.073).

Fact Value Tag
Compute size Small (2 GB, shared cores) [pred] inferred from max_connections = 90, the Small value. Never read from the dashboard.
max_connections 90 [prod] 2026-09-28
Connections in use 27 on 2026-09-28; 29 on 2026-07-17 [prod]
shared_buffers 655,368 kB (about 640 MB) on 2026-09-28; 512 MB on 2026-07-17 [prod]
effective_cache_size 1,966,088 kB (about 1,920 MB) on 2026-09-28; 1,536 MB on 2026-07-17 [prod]
work_mem 5 MB [prod]
Database size 62 MB [prod]
SQL CPU 35.0 s of DB time per hour = 0.97% of one core, over a 69.8-minute window [prod] 2026-09-28
SQL CPU 49,464 ms of DB time in one hour, about 1.4 % of one core. realtime.list_changes took 40,671 ms of it [prod] 2026-11-07, #323 hour
Host RAM used 70-90% of 2 GB at near-idle [pred] July 2026 estimate, never measured
Host swap, host CPU unknown not measured

Two points need attention:

  • SQL CPU is not the constraint. It excludes PostgREST, Auth, Kong and Realtime on the same host. Host CPU is still unmeasured.
  • shared_buffers grew from 512 MB to about 640 MB between July and September. effective_cache_size grew from 1,536 MB to about 1,920 MB. The Small ratios are 25% and 75% of 2 GB. The new values do not fit those ratios. Either Supabase changed its defaults, a custom override exists, or the size is not Small. Step 2 checks this. A larger buffer pool also leaves less RAM for the other services.

Supabase's rules for "too small" [docs].

  • "If your swap is above 70%, chances are high that your compute hardware is not suitable for your workload." Source: https://supabase.com/docs/guides/troubleshooting/exhaust-ram.
  • High swap matters when the instance is "consistently using more than 75%" of RAM. "High Swap is usually not a problem unless other resources (such as RAM) are constrained." Source: https://supabase.com/docs/guides/troubleshooting/exhaust-swap.
  • On the 1 GB size, about 50% base memory use is normal, from the services that run next to Postgres [docs].
  • The docs name the dashboard page "Database Health in the Observability section". The metric names for swap activity are node_vmstat_pswpin and node_vmstat_pswpout [docs].

What to do

Agents have no prod or dashboard access. Every step is [maintainer]. This issue changes no repo file.

  1. [maintainer] Set the order with Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 and Find the cause of the 13-15 s realtime list_changes spikes #325. Follow [Tracking] Supabase prod security and performance review, 2026-09-28 #327 §Order and dependencies. Post the planned UTC start and end here, on Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 and on Find the cause of the 13-15 s realtime list_changes spikes #325. Start Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 only after the step 5 ruling. If Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 must run first, start the window 24 h after Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 ends.

  2. [maintainer] Confirm the size. Open the Supabase dashboard, project tglymsfloxmouzjuoycu, then Project Settings → Compute and Disk. Record the compute size and any add-on.

  3. [maintainer] Explain the buffer settings. First list the custom overrides with the Supabase CLI. It reads through the Management API, needs your CLI login, and changes nothing:

    cd packages/supabase
    bunx supabase postgres-config get --project-ref tglymsfloxmouzjuoycu

    Then run this read-only SQL in the dashboard SQL editor:

    select name, setting, unit, source
    from pg_settings
    where name in ('shared_buffers', 'effective_cache_size', 'max_connections', 'work_mem', 'maintenance_work_mem');
    
    select count(*) as backends, coalesce(application_name, '') as app
    from pg_stat_activity
    group by 2
    order by 1 desc;

    Post only the memory settings from both reads. Post no other override values, because the repo is public. If postgres-config get lists shared_buffers or effective_cache_size, a custom override explains the change. If it lists neither, and the size is Small, Supabase changed its default. Overrides persist across a size change, so record them before any ruling.

  4. [maintainer] Start the 7-day window. Open Observability → Database Health (or Reports → Infrastructure, if that is where the chart appears). Record the start time in UTC. The window must not span a Postgres upgrade (Upgrade Supabase Postgres from 15.8.1.073 to 17 #322), a compute change or a project restart. If one happens, restart the window.

  5. [maintainer] Record once a day for 7 days. For each UTC day, set the time picker to that one UTC day (24 h). Read the highest point for memory, swap and CPU. For memory, use RAM used, without cache and buffers. Record the chart interval in the table header. The daily max is the rule input in step 5, not one point read. Fill one row per day:

    Day (UTC date) Memory used % daily max Swap used % daily max CPU % daily max Events that day (deploys, incidents)

    Add a summary row: median and range for each daily max column.

  6. [maintainer] Apply the decision table and post the ruling. Post the filled table and one ruling line as a comment on this issue. Update the Measure prod memory, swap and CPU for 7 days before any compute change #324 row in [Tracking] Supabase prod security and performance review, 2026-09-28 #327.

    Read the rows top to bottom. The first row wins over all others. The CPU row is independent of the size rows.

    Observed over the 7 days Reading Money Action
    The dashboard shows a size other than Small The inference was wrong depends Record the real size. Redo this table with that size's RAM.
    Swap above 70% on 2 or more days Too small [docs rule; the day count is a pred threshold] +$45 a month (Small to Medium) Upsize to Medium in the Upgrade Supabase Postgres from 15.8.1.073 to 17 #322 maintenance window, so the downtime happens once.
    Swap at or under 70% (one-day spikes allowed), memory high but flat Small fits. High memory is cache and base services. $0 Keep Small. Close this issue.
    CPU peak above 80% on 3 or more days Not a billing signal on its own $0 Keep the size ruling. Open a separate issue to find the CPU user.

    A one-day swap spike can come from a backup or a restart. Note its cause in the "Events" column. Note any Move production to a new Debian 13 droplet #747 cutover day there too. The day counts are thresholds this issue proposes, not Supabase rules.

Out of scope

Acceptance criteria

  • The compute size and any add-on, read from Project Settings → Compute and Disk, are posted on this issue.
  • The step 2 memory settings are posted: postgres-config get memory rows, and the pg_settings rows with source. No other override values are posted.
  • The 512 MB to 640 MB shared_buffers change has a stated cause (Supabase default, custom override, or different size).
  • A 7-day table with memory, swap and CPU (daily max) is posted, with the window start and end in UTC.
  • The window does not span a Postgres upgrade, a compute change or a restart.
  • One ruling line names the matching decision-table row and the action.
  • The Measure prod memory, swap and CPU for 7 days before any compute change #324 row in [Tracking] Supabase prod security and performance review, 2026-09-28 #327 shows the ruling.

Verification

  • The dashboard compute size matches the size named in the ruling comment.
  • Re-run the step 2 pg_settings query. max_connections must match the size table in Context: 60 for Micro, 90 for Small, 120 for Medium.
  • The posted table has 7 consecutive UTC days, each with its chart daily max.
  • If the ruling was an upsize: after the change, Database Health shows swap under 70% for 24 hours. Post that reading on this issue.

House rules

  • Prod is the maintainer's. Agents never run SQL on prod and never call a Supabase MCP tool. Every prod step here is read-only except a ruled size change.
  • Smallest change that meets the ask. This issue measures and rules; it adds no scripts, dashboards or scrape jobs.
  • Simplified English in the ruling comment: short sentences, one name per thing.
  • Public issue: post no secrets, keys or personal data from the dashboard or the SQL results.
  • Bun only, if any command is needed (bun, bunx); never npm or npx.

Activity

  1. added
    Performance
    on Sep 28, 2026
  2. modified the milestones: v2.2.0, v2.3.0 on Oct 18, 2026
  3. HMarzban commented on Nov 3, 2026

    @HMarzban
    CollaboratorAuthor

    Status, 2026-11-03. Nothing is measured yet, and this issue changes no repo file. Left, all [maintainer]:

  4. modified the milestones: v2.3.0, v2.4.0 on Nov 4, 2026
  5. HMarzban commented on Nov 4, 2026

    @HMarzban
    CollaboratorAuthor

    Maintainer ruling, 2026-11-04

    Moved from milestone v2.3.0 to milestone v2.4.0, from the v2.3.0 open-issue review. It is a 7-day production window with no repo change, and it must not span the #322 upgrade.

    The issue stays open. Its remaining items are unchanged.

  6. modified the milestones: v2.4.0, v2.3.6 on Nov 9, 2026
  7. HMarzban commented on Nov 11, 2026

    @HMarzban
    CollaboratorAuthor

    Milestone note, 2026-11-11

    Maintainer ruling, 2026-11-11. Kept in v2.3.6, the benchmark milestone, because it gathers evidence. This voids the move to v2.4.0 in the 2026-11-04 ruling. The 2026-11-04 rule still holds: the window must not span the #322 upgrade.

    Order (step 0 of the body):

    1. Push the anon EXECUTE revoke on the three invoker notification RPCs (Revoke anon and public EXECUTE on three invoker notification RPCs #755).
    2. On one day, run the Find the cause of the 13-15 s realtime list_changes spikes #325 reset and start this 7-day window. Post the UTC start and planned end here and on Upgrade Supabase Postgres from 15.8.1.073 to 17 #322.
    3. On day 8 or later, after the step 5 ruling, start Upgrade Supabase Postgres from 15.8.1.073 to 17 #322.

    Step 4 now reads the Database Health chart's daily max for each UTC day. That daily max is the input to the step 5 table. The body has a Benchmark section with the pass rules.

  8. modified the milestones: v2.3.6, v2.3.7 on Nov 12, 2026
  9. HMarzban commented on Nov 12, 2026

    @HMarzban
    CollaboratorAuthor

    Moved to v2.3.7, 2026-11-12 (maintainer ruling). v2.3.6 ships on 2026-11-14 with only finished, measured work, and its 7-day measurement windows cannot finish by then. The before values and the plan in this issue stay as they are.

  10. HMarzban commented on Nov 16, 2026

    @HMarzban
    CollaboratorAuthor

    Review, 2026-11-16 (maintainer approved).

    • Removed decision row 3. It is a subset of row 2, so it never changes the outcome.
    • Removed the Micro row, the daily 12:00Z backend count and the two avg columns. No rule reads them, and a Micro ruling is not worth a second issue now.
    • Step 1 no longer reads the two pool sizes. No decision used them.
    • Step 0 now points to [Tracking] Supabase prod security and performance review, 2026-09-28 #327 §Order and dependencies, so the order lives in one place.
  11. modified the milestones: v2.3.7, v2.4.0 on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DevOpsPerformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions