Articles

Why isn’t my app scaling to zero? How to find what keeps it running

Find what keeps an app from scaling to zero with one command: requests, open connections, minimums or background work. Compared with Cloud Run, Fly.io, Railway.

Updated

On Gregale, gregale debug running my-api says why an app is still running instead of scaling to zero: the request, connection, minimum or background task that stopped the scheduler from parking it, with a history of what it saw. The scheduler checks every instance every 10 seconds; the debugger shows the reasons from those checks, in the same words every time. The debugger is in beta on Hobby, Pro and Scale.

Find out why

bash
# What is keeping it up, and what it looked like recently
gregale debug running my-api
gregale debug running my-api --since 1h --limit 50

# Each instance, its state and the wake that started it
gregale app instances my-api
gregale app wake-timeline my-api <wake-id>

# The idle timeout and minimum the scheduler is using
gregale app get my-api

A typical answer:

text
Why is my-api running?
Observed at 2026-11-28T15:30:43Z
Current observed causes:
  - min_instances: An effective minimum of 1 warm instance(s) is keeping 1 idle instance(s) resident.
Configuration: idle timeout 10s; configured minimum 1; effective minimum 1

Match the reason to the fix

ReasonWhat it meansWhat to do
request_activityA request is still running, or one arrived before the idle timeout ran outNothing, if the traffic is real. Long requests and streams count until they finish
open_connectionTCP connections were open when the scheduler checkedThe debugger lists each remote address, port and direction; close the ones you don't need
tail_taskswaitUntil() work is still running after the responseShorten or move that work to a job or queue
min_instancesYour minimum keeps idle instances warmgregale app update my-api --min 0
prewarm_floorA prewarm (POST /v1/apps/{slug}/prewarm) raised the minimum for a whileIt lifts by itself
scale_in_cooldownThe scaling policy's scale_in_cooldown_s hasn't passed since it scaled outWait, or lower the cooldown in your scaling policy
workload_modeWorkers, services and jobs don't park on idle requestsThat is by design; run request-driven code as an app or function
startup_graceThe instance started recently and hasn't reached its idle timeoutWait one idle timeout
activity_unknownThe scheduler is missing activity timestamps, so it keeps the instanceWait for the next check; tell us if it persists
no_blocker_observedNothing is holding the instanceIt parks or freezes at the next check

Check the idle timeout first

Most "it never scales down" reports are an idle timeout doing its job. An instance parks once it has had no requests for its idle timeout: by default 1 minute on Free and Hobby, 5 on Pro and 10 on Scale. You can set anything from 10 seconds up to twice your plan's default:

bash
gregale app update my-api --idle 30

A running instance is not always a billed one. About a second after its last request, an idle instance is paused in memory, and paused seconds aren't billed. At the idle timeout it is frozen (app instances shows frozen, the dashboard ◌ sleeping): it holds no concurrency, isn't billed, and parks to a snapshot after 10 minutes. A frozen instance's timers stop, so if your app must keep a heartbeat running, declare pause: never in gregale.yaml and expect to pay for its idle timeout. See Scale to zero.

What we measured

We deployed a small Node.js app on Gregale on 2026-11-28 with a 10 s idle timeout and kept it up in different ways:

  • One request: the debugger showed request_activity, then no_blocker_observed 20 s later. The instance was frozen within 16 s of the request.
  • An open stream: a server-sent events stream held open for 75 s showed as request_activity: 1 request(s) are currently executing. Eighteen seconds after the stream closed, the debugger reported nothing holding it.
  • Idle connections the app opened: three idle outbound HTTPS connections, and a connection the app wrote to every 3 seconds, did not keep it running. It froze about 20 s after the last request, as it did with no connections.
  • A minimum: with --min 1, the next check reported min_instances, as in the example above. --min 0 released it.
  • Waking up: the next request restored the app from its snapshot in 104 ms, and the instance was running 149 ms into the wake.

How other platforms compare

PlatformWhat keeps an instance running
GregaleRequests, open connections, waitUntil() work, minimums, cooldowns; gregale debug running names the one that applies
Cloud RunIdle instances can be kept for up to 15 minutes; minimum instances stay running
Fly.ioFly Proxy stops Machines when a region has excess capacity, in a loop that runs every few minutes; min_machines_running keeps some up
RailwayServerless sleeps a service after 5 minutes without outbound packets, sampled, so 5 to 10 minutes; database connections and NTP count
KoyebScales to zero after an idle period, 5 minutes by default, with no traffic and no held WebSocket or HTTP/2 stream

Checked against each vendor's public documentation on November 28, 2026: Cloud Run instance autoscaling, Cloud Run minimum instances, Fly.io autostop and autostart, Railway Serverless, Koyeb Scale-to-Zero.

Pricing

The debugger is free on Hobby ($10 a month), Pro ($30) and Scale ($99). Running instances are billed per second for the app's memory, and paused and frozen seconds aren't billed. Minimum instances (--min) are on Pro and Scale and are billed while they run. See Scale to zero and Gregale pricing.

Questions

How do I find out why my app is not scaling to zero?

On Gregale, run gregale debug running my-api. It names what stopped the scheduler from parking the app, such as request_activity, open_connection, min_instances or tail_tasks, and shows a history of its checks.

How long does an idle app stay running on Gregale?

Until its idle timeout passes with no requests: by default 1 minute on Free and Hobby, 5 on Pro and 10 on Scale. Set anything from 10 seconds up to twice the default with gregale app update my-api --idle 30.

Do idle database connections keep my app running?

Not in our test. Idle outbound connections the app held, and a connection it wrote to every 3 seconds, did not stop the instance from freezing about 20 seconds after the last request with a 10-second idle timeout.

Am I billed while an instance waits for its idle timeout?

Not while it is paused. About a second after its last request an idle instance is paused in memory, and at the idle timeout it is frozen; paused and frozen seconds are not billed. Minimum instances are billed while they run.