Can services be configured to go to sleep when they are inactive? If so, how is this done?
breyner794
HOBBYOP

9 months ago

How can services be deactivated when there is no activity in those services? As I understand it, this function makes them render, right? I am new to Railway and want to continue using it because I find it easier to use and really like its features. I am trying out the hobby subscription, as this project can continue, but since this is a trial, I want to see how I can save money on the service. I am also going to set a usage limit of $10 to see how it works. I look forward to your response. Thank you very much.

Solved$5 Bounty

4 Replies

Railway
BOT

9 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Railway

Hey there! We've found the following might help you get unblocked faster: - [📚 Variables](https://docs.railway.com/reference/variables) - [🧵 Advice about 'App sleep' feature for backup services](https://station.railway.com/questions/advice-about-app-sleep-feature-for-bac-f1c14702) - [📚 Serverless](https://docs.railway.com/reference/app-sleeping) If you find the answer from one of these, please let us know by solving the thread!

breyner794
HOBBYOP

9 months ago

This information wasn't very helpful. I read it, but it's not what I'm looking for... Thank you.


9 months ago

Yes. Enable “Serverless” (formerly App-Sleeping).

When enabled, Railway puts a service to sleep after ~10 minutes with no outbound traffic (e.g., no DB pings/telemetry). The next request wakes it; expect a small (reasonable) “cold start” delay on that first hit.

How to turn it on (per service)

  • 1. Open your project → the service → SettingsDeployServerless.
  • 2. Toggle Enable Serverless as demonstrated in the attached image.
  • More details

Important caveats

  • Anything that sends packets (DB connection pools, telemetry, scheduled pings, calls to other services) will keep the service awake. Sleeping is based on outbound traffic; inbound traffic doesn’t prevent sleep.
  • The first request after sleep has a small cold-boot.

Budget control (your $10 cap)

  • Go to Workspace → UsageSet Usage Limits.
    • Set a Custom email alert (soft limit).
    • Set a Hard limit at this amount Railway takes workloads offline for the rest of the cycle. Minimum hard limit is $10. (Available for Pro and auto-pay Hobby; prepaid plans use credits as the hard limit.)
    • More details

Plan note

Hobby has a $5 minimum usage and is fine for trying things out; combining Serverless + a $10 hard limit is the safest way to keep costs predictable.

Attachments


hamedshams

Yes. Enable “**Serverless**” (formerly App-Sleeping). When enabled, Railway puts a service to sleep after \~10 minutes with **no outbound traffic** (e.g., no DB pings/telemetry). The next request wakes it; expect a small (reasonable) “cold start” delay on that first hit. # How to turn it on (per service) * **1\.** Open your project → the service → `Settings` → `Deploy` → `Serverless`. * **2\.** Toggle `Enable Serverless` as demonstrated in the attached image. * [More details](https://docs.railway.com/reference/app-sleeping) # Important caveats * Anything that sends packets (DB connection pools, telemetry, scheduled pings, calls to other services) will keep the service awake. Sleeping is based on **outbound** traffic; inbound traffic doesn’t prevent sleep. * The first request after sleep has a small cold-boot. # Budget control (your $10 cap) * Go to Workspace → `Usage` → `Set Usage Limits`. * Set a `Custom email alert` (soft limit). * Set a `Hard limit` at this amount Railway **takes workloads offline** for the rest of the cycle. Minimum hard limit is **$10**. (Available for Pro and auto-pay Hobby; prepaid plans use credits as the hard limit.) * [More details](https://docs.railway.com/reference/usage-limits) # Plan note Hobby has a $5 minimum usage and is fine for trying things out; combining **Serverless** \+ a **$10 hard limit** is the safest way to keep costs predictable.

breyner794
HOBBYOP

9 months ago

thank you so much


Status changed to Open brody 9 months ago


Status changed to Solved brody 9 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...