Internal Load Balancer


I’m a bit confused on how the Internal Load balancer for Private Networks work and I can’t seem to find an answer in the docs.

I understand the Public Load balancer will route traffic to the closest running app (which is great).

The problem is that my app uses a database external to which is available in two regions (US and Japan) and should be Load Balanced. Each instance of the database is exposing the service as a WireGuard peer in org. How can I make the app find out which WireGuard peer has the lowest latency and redirect the requests to it? The database (ArangoDB) can be accessed using HTTP so that is not a problem.

I want to use load balancer and not having to set up apps to load balance the traffic to the database (for example an Nginx reverse proxy app in US that receives the internal traffic from the main app and passes it to the database).

I want this to happen:
User in US > US app > US ArangoDB instance
User in Japan > Japan app > Japan ArangoDB instance


Unfortunately what you’re describing isn’t possible, since the load balancer is only able to send traffic to apps running on Fly. I would recommend checking the FLY_REGION environment variable in your app, and connecting to the correct database for the current region your app is running in.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.