1

Site used to go down frequently on a near daily basis and is on Digitalocean VPS

Based on some suggestions I got on DO forum, I ran mysqltuner and increased innodb buffer pool size to 341M and innodb log file size to 64M

Since then the site goes down less but it still does every once in a while like last night.

There are plently of 'InnoDB: Cannot allocate memory for the buffer pool' in the mysql error log - pastebin

I've assigned swap space and I've ran netstat, vmstat etc too and everything seems alright.

But clearly I'm running out of memory as the logs suggest. How do I diagnose whats causing my server to run out of memory? Whether its a faulty plugin or apache or something else causing the issue instead of just upgrading the droplet?

Sam
  • 11
  • 1
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/115513/discussion-on-question-by-sam-how-to-diagnose-whats-causing-innodb-to-run-out-o). – Ward - Trying Codidact Oct 26 '20 at 02:57

3 Answers3

0

You may want to try MySQL Workbench which is free and quite useful for tasks like this.

Bodo
  • 11
  • 3
0

The issue seems like MYSQL is not getting enough memory to add to the buffer pool size. Setting up parameter need to be done with precaution if the values are too high you might have an issue with server hogging. InnoDB buffer pool size should be set to 50% of the available RAM in a low connection environment and 30% in a high connection environment. You can check more about the parameters here https://www.skynats.com/blog/mysql-server-optimization/

Themes3x
  • 11
  • 2
  • My InnoDB buffer pool size seems in line with your recommendations then. I'm on a 1GB memory droplet and my buffer pool size if 341mb – Sam Jul 21 '20 at 09:55
0

2020-07-15T21:33:55.734143Z 0 [Note] InnoDB: Initializing buffer pool, total size = 384M, instances = 1, chunk size = 128M 2020-07-15T21:33:55.748097Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12 2020-07-15T21:33:55.751593Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool

How much RAM do you have? Either it is very tiny, or you have a lot of RAM taken up by other things.

Rick James
  • 2,463
  • 1
  • 6
  • 13
  • I am on the $5 droplet by digital ocean with a memory of 1 GB ~# free -m total used free shared buff/cache available Mem: 985 512 105 26 366 293 Swap: 1023 88 935 – Sam Jul 21 '20 at 09:52
  • @Sam - Is MySQL then only thing in the droplet? – Rick James Jul 21 '20 at 18:22
  • No. It has wordpress installed on it and has a lot of content on the wordpress site. Nearly a thousand post with images. However this same droplet was easily handling around 5x the traffic it is getting now and did not go down – Sam Jul 22 '20 at 04:17
  • Something is chewing up the RAM; we need to figure that out. – Rick James Jul 22 '20 at 05:05
  • Yes. Rick, any way to find that out? I turned off the performance schema too in mysqld yet the site went down again – Sam Jul 26 '20 at 05:35
  • Did you change versions recently? – Rick James Jul 26 '20 at 05:40
  • No I haven't changed versions – Sam Jul 26 '20 at 06:36