Question

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

Posted November 15, 2013 4.9k 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 (https://www.digitalocean.com/community/articles/one-click-install-wordpress-on-ubuntu-12-10-with-digitalocean) 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.

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.

×
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.
Submit an Answer