Logo
Riven

Platform / Scale-to-Zero

Scale-to-Zero

Web services on Riven sleep when nobody's using them, and wake up automatically when a request comes in. You don't pay for a service that's sitting idle at 4 AM — but it'sstill there, ready, the moment someone visits.

What scale-to-zero is

A normal web service runs 24/7, whether or not anyone's using it — and you pay for all that idle time. Scale-to-zero changes that. When your service has no traffic for a while, Riven puts it to sleep, freeing up the resources it was holding.

The next time someone visits, Riven wakes it back up in moments. To your users, it just works. To you, it means you're only using compute when your app is actually doing something.

How sleeping works

Riven watches your service's traffic. After a period with no requests, it scales the service down to zero — the running process shuts down, and the service releases its compute.

While it's asleep, your service still exists — its URL, settings, environment variables, and domain are all intact. It's just not running a process, so it's not consuming resources.

Waking up

When a request arrives for a sleeping service, Riven catches it, starts your service back up, and forwards the request once the app is ready. The visitor waits a moment longer than usual, then gets their response — and the service stays awake for subsequent requests.

It stays awake as long as it keeps getting traffic. Once it goes quiet again, it sleeps again. This cycle happens automatically — you never trigger it.

The first request (cold start)

Waking a sleeping service takes a few seconds — this is called a "cold start." The very first request after sleeping is slower while the app boots up. Every request after that is fast, until the service sleeps again.

i

Cold starts are a fair trade for not paying for idle time. For most apps — side projects, APIs with occasional traffic, tools used during work hours — it's barely noticeable and saves real money.

If a cold start every so often isn't acceptable for your app — say a production API that needs to respond instantly at all times — you can keep it always-on instead.

Static sites don't sleep

Scale-to-zero only applies to web services, because they run a live process. Static sites are just files served from a CDN — there's no process to sleep or wake. They'realways available, with no cold start, ever.

So if instant response on every request matters and your app can be a static site,that's the simplest path — it never sleeps by nature. See Static vs Web Services.

Always-on option

Some apps can't afford a cold start — a production API, a service with a health check that must always pass, anything that needs to respond the instant it's called. For these, higher plans offer an always-on option that keeps your service running around the clock, no sleeping.

Always-on costs more, because you're paying for the service to run continuously — but it means zero cold starts. Choose it per service, so you can keep low-traffic services scaling to zero while your critical one stays always up.

Start with scale-to-zero. It's the cheaper default, and most services genuinely don'tneed always-on. Switch a specific service to always-on only when you find it needs to be instant every time.


Next steps