Question

How do I stop a small WordPress website crashing so regularly on Digital Ocean account?

Posted June 9, 2021 77 views
WordPress

Sorry, not sure how or where to ask this, but this seems a better place than SO.

I have a small WP website hosted on a Digital Ocean droplet and it keeps falling over with an “Error establishing a database connection” error. Restarting the server resolves it.
This is a bog standard, (very) low traffic WordPress site.

I’ve hosted similar, small WP sites for many years on standard shared hosting but for some reason, now I’ve moved this site to DO, it falls over on an absurdly regular basis.
I’ve checked the plugins, security and such and can’t see anything that would cause this. I’ve upgraded the account three times but I was under the impression a small site like this could be hosted for a couple dollars, not the $25 or such I’m paying now.

Again, this is a very low-traffic, bog standard WP website and I can’t see anything out of the ordinary considering I’ve had experience with WP sites for over 10 years and I didn’t have any issues before moving the site. Other than a one page portfolio, this is the only site on my account,

I feel like I’m missing something obvious, and as someone who’s not very good with DevOps, I realise I’ve made a mistake choosing DO, but I’m hosting this site for my sister and I’m hoping there’s some sort of obvious thing I’m missing before I move it again.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @philhancox,

It seems to me something is causing load on your Droplet and the Droplet is forced to kill some services so that it doesn’t crash. In most cases that’s the Database service thus you getting the Error establishing database connection.

My first suggestion would be to add SWAP to your Droplet if you don’t already have one. You can follow this tutorial if unsure how:

https://www.digitalocean.com/community/tutorial_collections/how-to-add-swap-space

Next, I would recommend optimizing your website and Droplet.

On the Droplet side, I’ll recommend using Opcache + php_fpm. These two will tremendously help you with how your Server is handling your Website.

Regarding your Website, I think you should install a Caching plugin, a plugin to optimize your images and similar stuff.

If you are still experiencing issues, I’ll recommend checking out top while inside your Droplet to see where exactly the high load comes from.