Hi, we had a lot of traffic to our services so we decided to scale up machines, bigger and better in our instance both for database and for app server. Despite that all of the machines are using mostly one db and our utilization looks like this. That’s horrendous, can I do something or can you tell me what I might messed up?
What kind of database are you using, who hosts it, is it managed, how are you connecting to it?
Same here, we have machines for the app in 4 different regions and created db replicas in the same regions thinking that it would distribute the traffic (using Fly Postgres), but it mainly uses our primary region database.
Are you using port 5433 (instead of 5432) for reads?
Currently no, so as far as I understand write operations would still go through the primary region?
If you’re using port 5432 then every query gets sent (unnecessarily) to the primary. The exact mechanism depends on the specific structure of your DATABASE_URL
, etc.
Your app needs to take special measures to switch to port 5433 when it knows that it only needs the read-only access that the local replica provides…
(The above link has more on this.)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.