Some basic questions about scaling apps

Hi, I’m quite new to infrastructure like Fly and I have some basic questions about scaling:

I have one app on fly (call it fly-app-1) with an attached postgres app (fly-app-1-db). The postgres app has been scaled across 3 locations.

If I scale fly-app-1, all instances share the same custom domain I have created for fly-app-1, and receive traffic according to their location, correct?

These instances all connect with fly-app-1-db, reading from whichever instance is appropriate, or reading/writing to the leader—yeah?

If the leader instance of postgres app fly-app-1-db fails, does one of the read replicas take over as read/write leader?

I expect to only see a trickle of traffic to my app, so scaling is really just for redundancy in case of outages or db failure. In that case, does it make sense to have just two instances of each app (fly-app-1 and fly-app-1-db)?

Essentially yes. Fly.io Docs:Traffic Routing


Correct. Fly.io Docs: Centralizing Logging and Metrics


If the leader becomes unhealthy (eg network or hardware issues), the proxy drops all connections until a new leader is elected. Fly.io Docs: High Availability


One instance should be fine for now. Fly.io Docs: count-scaling

3 Likes

Thanks @Christian_B, much appreciated!

1 Like