Optimize Usage
Railway provides controls over resource usage in the form of usage limits and auto-sleeping of inactive services.
Configuring Usage Limits
Usage Limits allow you to set a maximum limit on your usage for a billing cycle.
Visit the Account Usage page to set the usage limits. Once you click the Set Usage Limits button, you will see a modal above where you can set a Custom email alert and a Hard limit.
Setting Limits for Teams
If you want to set a usage limit for your team, use the account switcher in the top left corner of your dashboard to access the team's usage page.
Setting Limits for Prepaid Plans
If you are on a prepaid plan, you can not directly set a hard limit. Instead the amount of credits you load determines the hard limit.
Custom email alert
Configure a soft limit by setting a threshold in Custom email alert. When your resource usage reaches the specified amount, we will email you that this threshold has been met and resources continue running.
Hard limit
Configure a hard limit to take resources offline once usage meets the specified threshold.
Multiple emails will be sent as your usage approaches your hard limit:
- When your usage reaches 75% of your hard limit
- When your usage reaches 90% of your hard limit
- When your usage reaches 100% of your hard limit and workloads have been taken down.
Find more information about Usage Limits in the reference page.
Use Private Networking
Using Private Networking when communicating with other services (such as databases) within your Railway project will help you avoid unnecessary Network Egress costs.
With databases
Communicate with your Railway database over private networking by using the DATABASE_URL
environment variable, instead of DATABASE_PUBLIC_URL
:
With other services
If your Railway services need to communicate with each other, you can find the service's private URL in the service settings:
Learn more about Railway's Private Networking here.
Enabling App Sleeping
Enabling App Sleep on a service tells Railway to stop a service when it is inactive, effectively reducing the overall cost to run it.
To enable App Sleeping, toggle the feature on within the service configuration pane in your project:
- Navigate to your service's settings > Deploy > App Sleeping
- Toggle "Enable App Sleeping"
- To disable App Sleeping, toggle the setting again
Read more about how App Sleeping works in the App Sleeping Reference page.
Resource Limits
Resource limits are a way to limit the maximum amount of resources available to a service.
To toggle resource limits, navigate to your service's settings > Deploy > Resource Limits.
Use Resource Limits
Using resource limits makes sense in scenarios where:
- You don't want to risk a high bill due to unexpected spikes in usage
- You are okay with the service crashing if it exceeds the limit
Edit this file on GitHub