GOBLIXO✳Field guides ↗
← THE GOBLIXO BLOG / How it works

Why your free Railway app falls asleep

Measure the first and second requests to a Railway Free service, then check logs to distinguish a cold start from a persistent problem.

QUICK ANSWER

Measure a first request after idle and an immediate follow-up. Use the deployment and database logs to explain the gap.

BY GOBLIXO EDITORIAL · 3 MIN READ
PUBLISHED 2026-11-20 · SOURCES CHECKED 2026-11-20
In this story
GOBLIXO illustration. First request — Check wake time. Immediate follow-up — Compare warm time.
Guide

A slow first request is a clue

A demo works while you are building it. You leave it alone, return later, and the first page request takes much longer than the second. That pattern is consistent with an app waking from sleep, especially if the service logs show a new start. It can also be a database connection or a slow initialization path. Measure the first and second requests before changing the deployment.

Railway’s Free plan documentation says services run serverless and typically sleep after five to ten minutes without outbound traffic. The next request can wake the service. The timeout is approximate, and software that keeps sending traffic may leave the service awake. Railway also documents that a request on wake may encounter a 502. Compare the app’s behavior with its logs rather than assigning every 502 to sleep.

Capture two requests you can compare

Pick a read-only route on a service you control, such as a status page. Make one request while the app is warm, then leave it idle long enough to test the documented sleep window. Temporarily stop your own test traffic where convenient. External monitors can affect whether the process actually goes quiet. Use the same client and URL so you are comparing similar conditions.

For each request, record the HTTP status and the times for connection, first byte and completion. From a terminal, curl can report these with the variables http_code, time_connect, time_starttransfer and time_total in its write-out option. Give the slow request enough time to finish and keep an upper timeout in place. Repeat immediately afterward. A large first-to-second difference is actionable evidence. One measurement alone is not proof of the cause.

Read the application and database logs

Look for startup messages around the slow request, then check how long the app took to become ready and whether the first request waited for a database. If both services can sleep, the first request may involve waking both. A lightweight status endpoint and a normal read endpoint can show whether the extra delay appears before or after a storage call.

If every request is slow, inspect the code path and region or network latency rather than assuming a cold start. If the first and second both fail and the deployment or usage dashboard shows a stopped service, inspect its current status. An exhausted monthly resource allowance and an idle service can look similar from a browser until you read the project state.

Deal with the cause that fits the evidence

For an occasional demo, reduce what the process does before it starts answering. Expensive initialization and external calls on startup can make each restart more noticeable. Only defer work when the route can still return correct results. Return a clear loading or retry state for temporary failures on safe read operations.

If a page can be generated in advance, static hosting can remove an unnecessary server from that request path. If the feature needs a dependable always-awake process, check Railway’s current plan options and usage terms before committing. A keepalive ping consumes resources and changes the idle test. It gives you a different workload with its own trade-offs.

Keep a baseline you can repeat

Record the deploy version, idle interval, first status and duration, second duration and whether the app or database logged a start. Run the same check after changing initialization. If first-byte time drops and the rest stays similar, you have a focused improvement. If both calls stay slow, the numbers are a reason to investigate something else.

There is no single cold-start number to apply to every app. The method above is a test you can run on your own deployment. Start with one warm request and one request after a documented idle window, then use the service state and logs to put a name on the difference.

Sources & editorial notes

Based on official documentation, checked 2026-11-20. Examples are illustrative. This is research, not hands-on testing; provider terms and availability can change.

  1. Railway — Free plan and limits ↗
  2. Railway — sleep and wake behavior ↗
  3. curl — write-out variables ↗

Questions about a product? Use the provider’s official support. Never share recovery phrases or private keys.

Keep asking better questions.

ALL STORIES ↗