A status checker meant to watch a site was waking that site’s database every 10 minutes. The database is a serverless one, so it only costs compute while it is awake and goes to sleep when nothing has connected for a while.

In October a second project used up its free allowance of 100 compute-unit hours for the month. The organization was on a paid plan by the time we audited the scheduled jobs on 10/19.

Why a poll costs money

On a serverless database every poll wakes the compute and bills hours.

What kept it awake

The database was capped at 0.25 compute units, with a 300-second suspend timeout. Any job that opens a connection keeps the compute awake and billing. Two scheduled jobs did exactly that.

The first was a status checker on a personal test machine, running every 10 minutes. It loaded a public homepage, and that page queried the database on every load. So the thing built to watch the site was also the traffic that kept the database awake. The checker was broken as well: it compared against an old server IP.

The second was a ledger sync timer on the server, on a 15-minute cycle. That is 96 runs a day, and each run woke the database for at least five minutes. Our own back-of-envelope figure, not a measurement, is at least 8 awake hours a day from the sync alone, or roughly 2 compute-unit hours a day at 0.25 units.

What we turned off

On 10/19 at about 13:18 ET the status checker was switched off. At about 13:37 ET the sync timer was disabled. These two shutdowns are the primary fix, and both happened the same afternoon. The direction for the sync is to run it only on demand, when someone opens the review page, with an “updating in background” note while it works.

That part is not built yet. Until it ships, the accounting pages do not update on their own, and a manual run is the workaround. The plan for the status check is a route that does not touch the database at all, running on the venture’s own server instead of a personal machine.

Letting it sleep

The other half of the answer is to hit the database less, so it can sleep more. Public pages (the home page, the events list and each event page) now come from a cache instead of querying the database on every visit. A visit served from the cache does not wake it.

The cache clears when an event is edited or a ticket sells. A small follow-up fix covered free registrations. The change went through an outside review before it was merged.

We have no settled figure for what this does to database transactions per visit, so we are not claiming a number. The cache is the secondary change. The shutdowns above are the separate, primary fix.

What the follow-ups look like

We filed three dated follow-ups: a day-1 usage check on 10/20, a day-3 check on 10/22, and a switch back to the free plan on 11/1.

What to take from it

Monitoring and sync jobs that touch a serverless database are not free, because each one wakes it and keeps it billing. Count them as load before you add them, and point health checks at a route that never reaches the database.

Two jobs, a 10-minute checker and a 15-minute sync, are off as of 10/19. The day-1 and day-3 usage checks are filed.