Prevent MySQL crashing

On our support forum and GitHub issue tracker, we are seeing some are facing MySQL crashing issue. This issue is commonly observed on Digital Ocean 512 plan.

We are still working on preventing MySQL crash, below are some common points and measures observed.

Low Swap Memory

For all VPS we recommend at least 1GB swap.

How to create SWAP:

Adjusting PHP5-FPM pm.max_children:

By default EasyEngine sets this values to 100, thanks to Kym for pointing, on low RAM VPS, for high traffic PHP5-FPM takes nearly all RAM, leaving no RAM to MySQL

Change PHP5-FPM pm.max_children:
Open www.conf file:

vim /etc/php5/fpm/pool.d/www.conf

For 512MB – 1GB RAM:

pm.max_children = 10

For 2GB RAM:

pm.max_children = 20

For 4GB RAM:

pm.max_children = 50

After that you need to restart PHP5-FPM

php5-fpm -t && service php5-fpm restart

Tuning MySQL

Tuning MySQL is always good practice. You can use following command to get MySQL tuning suggestions.

  • MySQL Tunner
  • Tuning Primer

Adjust the MySQL values as per suggestions in my.cnf file

vim /etc/mysql/my.cnf

and restart MySQL

service mysql restart

If you still facing MySQL crashing issue, we are always ready to help you, for this you can use this thread: #244