I'm trying to figure out how railway.com implements usage-based pricing while efficiently managing resources to remain profitable. In theory, I could set up a Kubernetes cluster that scales vertically based on resource thresholds. However, I understand that an auto-scaler needs to define minimum resources through the requests field. This raises a concern: doesn't this setup imply a fixed minimum cost for each container? It seems that railway charges based solely on usage without showing fixed minimum costs. How can Kubernetes be configured to scale based on actual resource consumption? Could I use limits without requests, or would that create issues with node pressure? If my grasp of railway's model is flawed, I appreciate corrections, along with any links to open-source solutions that might replicate this scaling capability. Thanks in advance!
3 Answers
From what I know, you actually choose how much RAM you want on railway, and they provision an instance accordingly. If you adjust the RAM allocation, they simply create a new pod with the updated limits. If they offer a serverless option, they could be using a proxy pod similar to an Ingress controller to manage any downstream pods. KEDA might assist with HTTP-based scaling as well. Just a heads up, it seems you pay for reserved RAM and CPU rather than purely for the actual usage; railway's pricing is around ~$10 per GB of RAM and ~$20 per vCPU each month. Seems to me that their model allows for a decent profit margin compared to traditional cloud costs!
Platforms like railway are known to practice aggressive overcommitting along with cgroup-level usage metrics. They rely on tight node autoscaling and bill based on actual CPU and memory consumed rather than the requests set. If you're aiming for something similar, consider using Vertical Pod Autoscaler (VPA) in recommended or auto mode combined with Karpenter or the cluster autoscaler. You’d also want a custom metering layer to track real usage instead of sticking to reserved capacities. That way, you could get pretty close to how they operate.
Actually, railway doesn't use Kubernetes. They’ve mentioned this in their blog, but I don't have the exact link right now. A simple Google search should show you various sources confirming this. So, trying to mimic their scaling directly with K8s might not yield the same results as they employ different techniques.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically