UPDATE
Ghost Version: 4.41.3
Theme: Reditory
No. of Members: ~280k
Deployment on: AWS EC2 t3.med instance
Database: AWS RDS db.t3.small gp2 instance
Problem:
Upon more digging, we discovered that Ghost actually goes down on three occasions:
- A lot of API requests are made (See Ghost goes down with many api requests)
- Scrolling down the members page in ghost admin portal (the initial load for this is also very slow)
- Publishing posts w/ newsletter sending (this does not always cause ghost to go down. mostly it just does not work properly [See previously elaborated issue below])
What we realized was that ghost goes down (apache does not go down and instead just throws a 504 error when trying to access the ghost blog) when it’s performing a high volume of read/writes to the databse.
Additionally, we saw this error being thrown a lot in the error logs:
{
"name":"Log",
"hostname":"ip-xxx-xx-x-xxx",
"pid":787,
"level":50,
"err":
{
"domain":"https://xxx.xx",
"message":"Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?",
"stack":"KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
at Client_MySQL2.acquireConnection (/var/www/xxx/versions/4.41.3/node_modules/knex/lib/client.js:348:26)
at runMicrotasks (<anonymous>)
at runNextTicks (node:internal/process/task_queues:61:5)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)"
},
"msg":"Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?",
"time":"2022-12-30T13:55:57.491Z",
"v":0
}
We’ve already tried increasing the pool connections from the default as chatGPT suggested here but it has not helped:
"pool": {
"max": 50,
"min": 10,
"idleTimeoutMillis": 5000
},
"acquireConnectionTimeout": 10000
Our theory is that the maximum IOPS provided by the RDS instance is bottlenecking the huge reads and writes our ghost instance is making because of the huge number of members. Is this the issue?
If so, what’s the recommended RDS deployment for ghost with this many members?
If this is not the issue? What is and how can we fix this?
Previous Post
Ghost Version: 4.41.3
Theme: Reditory
Problem: Newsletters not sending properly
The main problem is that newsletters are not sending properly to members. There are currently 200k+ members to this ghost blog but recently, only around 10k - 60k are being sent when a post is published.
This also manifests by the sends / opens not showing up in the ghost admin portal (image attached). I was only able to confirm that emails were in fact being sent just to some members by checking logs in mailgun directly.
We also cannot upgrade to the newest version because the theme we’re using is not compatible anymore.
Any help would be greatly appreciated. Thank you very much!