500 Error Postgresql

I have been getting 500 Errors on my forum recently. A rebuild fixes them.
This is what the log says:

could not connect…

What can I do to fix this? Or where can I find out more as to what causes the error.
Any help much appreciated.

So you have enough ram?

Your big is your database? How much ram? How many users /page views?

Hi Jay,

4GB RAM /80GB DISK, Digital Ocean hosting. We have about 700 users. Page views yesterday 273, normally in the region of 100-600 per day. The size (going by the backup size) is 1.1.gb.

And yes: Digital Ocean console reports a lot of Out of Memory errors. I though my site was pretty small and should be fine with the above specs? Maybe I should go to 8gb, double the price at Digital Ocean…

No need to resize the droplet, it is more than enough, you should run the discourse-setup to be sure the settings are alright:

cd /var/discourse

Don’t worry, you won’t lose anything, it will only redo the app.yml, but save a backup just in case before.