Problem with Wordpress and MySQL connection when i publish/edit a post

November 15, 2013 2.2k views
First of all, I'm using Google translator because my native language is Spanish. So sorry for the mistakes! Now, the main problem: Currently I have a 512MB Droplet with Wordpress which was configured with this tutorial ( The problem I have now is that every time I post something or edit any post, it takes too long to respond and then appears a message saying that the Wordpress lost connection to the database. Obviously stopped and restarting MySQL returns everything to normal. What I notice is that when publishing the post, the CPU gets too high, almost 80%. What is what could be happening? I know is something related to MySQL and his configuration, but i´m not able to figure it out.
3 Answers
It's too bad that the DigitalOcean's one-click WordPress install uses Apache; given that Nginx w/caching provides MUCH better performance (especially on a 512MB droplet). To address your current problem, add swap. See How To Add Swap on Ubuntu 12.04.

If you want a WordPress installation that can handle heavy loads (especially on a 512 MB droplet), check out How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.
by Etel Sverdlov
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process. This tutorial covers installing wordpress on a LEMP stack (with nginx instead of apache), and then installing varnish.
Thanks for the answer!!
I already added swap memory (1GB), wich help a lot, but the problems continues.
Is there a chance to change the droplet configuration to varnish and nginx?
"Is there a chance to change the droplet configuration to varnish and nginx?"

Yes. Simply execute:
sudo apt-get -y remove --purge apache2

Then, follow the instructions in the guide referenced above.
Have another answer? Share your knowledge.