Asking for custom load balancer
sj0605-datasci
HOBBYOP

5 months ago

Hi Team, I am Sanyam, i am on hobby plan of railway, recently charge 80 dollars (30 - vcpu usage, 50 - memory). On railway I have 2 projects (staging, prod) + each having 2 instances

In my code I m having 4-6 workers and using queues, rather you know having workers and then filling queues, i was thinking can Railway provide custom load balancer such that based on request i received, i can reroute it to particular instances?

Solved

6 Replies

dev
MODERATOR

5 months ago

You unfortunately can't customize the load balancer Railway uses, I can only see the ability to customize the load balancer being supported at an enterprise customer level maybe, but even then I'm not sure

The only workaround I can think of is having two duplicates of the same service (which mimicks 2 replicas) and then having a seperate third service act as a proxy that load balances between the two services for you, routing requests to one of the two depending on how your load balancing schema works

You could even use Railway's GraphQL API to intelligently route based on the load of either replica service, routing to the one who the least memory usage for example.


dev
MODERATOR

5 months ago

-# the only drawback I can think of here is difficulty synchronizing settings between the two services and horizontal scaling becomes more difficult and limiting since you can only have so many parallel builds, but I don't think there's any other way to customize load balancing


dev
MODERATOR

5 months ago

Actually If I remember correctly, you can get the ipv6 addresses of individual replicas in a service by doing an AAAA lookup on the service's private domain and from there you can target individual replicas.

I'm not sure if you can trace that address back to the specific Railway deployment instance, and without doing that- I don't think you can route based on info from the Railway API unfortunately but this is another option you can consider.

In this case you'd have one service with its replicas (in this case 2) and another service acting as a load balancer. Meaning you'll have 2 services (one holding replicas and one load balancing) instead of a service for each replica and a load balancer service.


dev
MODERATOR

5 months ago

Do you have any more questions?


dev
MODERATOR

5 months ago

I'm gonna go ahead and mark this as solved since I believe I did answer your original question, if you have more questions or follow ups then feel free to open another thread


dev
MODERATOR

5 months ago

!s


Status changed to Solved dev 5 months ago


Loading...