I’m looking for sone best practice around making sure my services are always running.
I have a staging app and a production app, using Phoenix.
From yesterday I’ve been having intermittent errors when deploying to staging (via GitHub actions or manually):
(DBConnection.ConnectionError) connection not available and request was dropped from queue after 2977ms. This means requests are coming in and your connection pool cannot serve them fast enough
To try and fix this, I believe I scaled my database to a single user using scale (the activity log in the dashboard for the database says “scale” in there) but mind you when I ran that command several times it “did not recognise … name”, even though its the only visible name for the db that I can find (eg via fly apps list in the console), and I cannot find anywhere else to check the scale, “fly scale show” in the console shows the app not the db.
The replication lag just before one of these failed deployments was 20000 whatever that means - and then dropped to 0, but there are 1 or 2 people max using this staging service, If the DB is still multi user it would make sense, it must be a simple thing to be able to check the database scaling?
Anyway none of this would worry me too much - I set up the production with a more powerful everything 8GB dedicated cpu 4x (including db - but then how would I check?) - but then it fell over with some strange errors
syd [error] error.code=2002 error.message=“App connection problem” request.method=“GET” request.url="https://app. my_domain .com/company" request.id=“01FBTQTVRQ4JNSRKGEPF97KVZB” response.status=502
Given that error - I would like to check staging but that’s falling over because of the database connection error.
So I guess my query falls into two areas:
- How do I see my database scale, why am I getting so many of these connection errors since yesterday?
- How do I create redundancy? Do I create another app which replicates production and then quickly point my CNAME at it if a deployment to the “real” production app fails with error codes?
- For a Phoenix LiveView app is 8GB enough? The app is quite mundane really - and it seems quick usually.
Thanks for your help,