mysql,

MySQL: configure innodb_buffer_pool_size

Dec 12, 2022 · 1 min read · Post a comment

Running out of memory on small MySQL instances (less than 1GB) hosting WordPress sites was a common thing for me, for a while. Even creating swap disk didn’t help as the MySQL service was crashing mostly because of OOM (out of memory). Not sure what the error was, but as far as I remember the logs were pointing to innodb_buffer_pool_size. So, about the sizing of this parameter.

Prerequisites

  • MySQL

Solution

innodb_buffer_pool_size is a MySQL config parameter that defines how much memory will be allocated to the InnoDB buffer pool. This buffer pool is an extent in the memory where the most accessed data is stored including InnoDB table and index data. And, InnoDB is the default storage engine for MySQL that’s responsible for storing data on a disk and keeps the most frequently access data in memory.

As a rule of thumb, innodb_buffer_pool_size should be 80% of the RAM. This is a starting point. Probably works for most servers with more than 1GB of RAM.

When dealing with small and micro instances with less than 1GB of RAM, I would suggest to leave innodb_buffer_pool_size with the default value of 128MB. If that’s not enough, at last, create a swap partition.

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.