5 months ago
How does vertical and horizontal scaling work in railway? Which events trigger it?
6 Replies
5 months ago
Vertical Autoscaling
- Automatically increases vCPU and RAM as your service nears the limits of its plan. 
- No manual input needed—just monitor usage and Railway scales up for you. 
Horizontal Scaling (Replicas)
- You manually adjust the number of replicas in your service settings. 
- Creating, deleting, or moving replicas across regions triggers a redeploy, and Railway handles local/global load balancing. 
You can find further details here : 
https://docs.railway.com/reference/scaling
5 months ago
Vertical Scaling
- Go to your project on Railway.app. 
- Click your Service (e.g., backend). 
- Click the  Settings tab. Settings tab.
- Scroll to Resource Settings: - Change the RAM (e.g., 512MB → 1GB). 
- Adjust CPU if needed. 
 
- Click Save & Redeploy. - Horizontal Scaling - Go to your service on Railway. 
- Under  Settings > Scaling, look for: Settings > Scaling, look for:- Replicas → Increase manually to e.g., - 2,- 3, etc.
- This deploys multiple containers behind a load balancer. 
 
 - Automatic Horizontal Scaling (Autoscaling) - Same path: Go to  Settings > Scaling. Settings > Scaling.
- Enable Auto Scaling. 
- Set: - minReplicas: e.g., 1
- maxReplicas: e.g., 5
- CPU Threshold (%): e.g., 70% 
 
- Click Save. 
 
5 months ago
Hey danmio!
Vertical scaling on Railway is when you give your service more power by increasing the CPU or memory it uses. You do this by picking a bigger size in the settings. If your app is running slow or using too much memory, you might want to scale up. This is something you change yourself.
Horizontal scaling means running several copies of your app at the same time, which helps handle more people using your app. You set the number of replicas (copies) in the Railway dashboard. If you're getting more traffic or want more reliability, just add more replicas. This is also something you do manually.
Railway won’t automatically add more power or more copies if your app gets busy. You’re in charge of making those changes when you notice your app needs it.
Hope that helps!
4 months ago
Here is Railway's official documentation on this https://docs.railway.com/reference/scaling
4 months ago
At a basic level
Horizontal: more machines aka multiple replicas
Vertical: bigger machine aka more ram, cpu etc on the same machine
4 months ago
Railway provides both vertical and horizontal scaling for your applications.
Vertical Scaling (Scaling Up)
How it Works: This involves adding more resources (vCPU and Memory) to a single instance of your service. Think of it like giving a single worker a bigger desk and more tools to handle more tasks.
Triggers: Railway's vertical autoscaling is enabled by default. It automatically scales your service's resources (up to your plan's limits) based on its traffic and resource consumption (CPU and Memory usage). This means if your service starts demanding more processing power or memory, Railway will dynamically increase those resources for that single instance. It also scales down when demand is low to save costs.
Horizontal Scaling (Scaling Out)
How it Works: This involves running multiple identical instances (replicas) of your service. Instead of one powerful worker, you have several workers, each handling a portion of the workload. Railway automatically handles load balancing between these replicas.
Triggers:
Manual Configuration: You primarily trigger horizontal scaling by manually configuring the number of replicas for a service in your Railway project settings. You can set the desired number of instances.
Traffic/Queue Time (via Integrations like Judoscale): While Railway's built-in autoscaling is primarily vertical, for more advanced horizontal autoscaling based on request queue time (how long requests wait to be processed) or job queue latency (for background workers), you can use third-party integrations like Judoscale. This allows for more precise and responsive horizontal scaling based on actual application load rather than just raw CPU/memory.
Deployments/Changes: Creating, deleting, or re-assigning replicas will trigger a redeploy of your service to reflect the new scaling configuration.
Key Takeaways:
Vertical scaling is automatic and resource-based.
Horizontal scaling is primarily manual on Railway's side, but can be automated with third-party tools based on queue performance.
Status changed to Solved chandrika • 4 months ago
