Question

New $5 MySQL/Wordpress Crashing — InnoDB memory issue

Posted January 14, 2020 126 views
MySQLWordPress

We’ve set up a few independent websites using a minimum $5 droplet, using WordPress and MySQL.

In the minimum config, doing stuff in the admin panel, MySQL crashes regularly. This means we get an “Error — Failed to create a database connection”. When I go into the droplet via ssh I have to restart the service, using

It’s the latest version of the droplet (set up in mid and late 2019), using Ubuntu 18.04, and WordPress 5.0+.

service mysql start

The mysql error log shows

2020-01-14T20:00:24.293860Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2020-01-14T20:00:24.293878Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2020-01-14T20:00:24.293885Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-01-14T20:00:24.293895Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-01-14T20:00:24.307238Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-01-14T20:00:24.307284Z 0 [ERROR] Failed to initialize builtin plugins.
2020-01-14T20:00:24.307291Z 0 [ERROR] Aborting

2020-01-14T20:00:24.308788Z 0 [Note] Binlog end
2020-01-14T20:00:24.315381Z 0 [Note] Shutting down plugin 'CSV'
2020-01-14T20:00:24.319326Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

Based on this, it seems some problem with InnoDB and memory.

This is a blog with almost zero traffic, and only two logged-in users, doing very basic things like uploading images. It seems to happen because we’re trying to do something, but sometimes the server fails on its own.

The InnoDB buffer size is set at default currently - 128MB.

In the past, I’ve only been able to fix this by upgrading to a $10 droplet, but is that necessary? I think there may be a configuration issue.

Thanks in advance.

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.

×
1 answer

Hi @danaab272c4056f8633ea36d3a,

Here are the basic requirements for a WordPress website without doing anything on it :

Disk Space: 1GB+
Web Server: Apache or Nginx.
Database: MySQL version 5.6. 15 or greater or any version of MariaDB.
RAM: 512MB+
PHP: Version 7.3 or greater.
Processor: vCPU 2

This is just for the installation without anyone working on the website. Now, this doesn’t mean you can’t optimize your droplet so that it performs better under the website.

I’ll recommend installing Opcache as well as PHP-FPM, it really does wonders to your setup.

Additionally, if your Database is being killed so often, it would mean as you most probably know it’s being killed by your server as there is RAM shortage, this is indeed not how it’s suppose to react. I’ll assume you don’t have any SWAP enabled which is again part of the issue.

I’ll recommend enabling 1 or 2 GB of SWAP on your droplet and this will actually help with the errors you are experiencing.

Regards,
KDSys

Submit an Answer