Mysql – Optimal Number of MySQL InnoDB Buffer Pool Instances

buffer-poolinnodbMySQL

Server Characteristics

  • Total system RAM: 8GB (running MySQL + other stuff than MySQL on it i.e. not dedicated to MySQL)
  • Number of CPU Cores: 6
  • I have data in the db amounting to about 2GB
  • I have InnoDB Buffer Pool Size set to 4GB

Which is better:

  • Innodb Buffer Pool Instances set to 1?
  • Innodb Buffer Pool Instances set to 2 (2GB in each)?
  • Innodb Buffer Pool Instances set to 4 (1GB in each)?
  • Innodb Buffer Pool Instances set to 8 (the default setting)

I'm thus not sure as to how to reason when it comes to Buffer Pool Instances and also the whole "use instances or suffer OS Swap when having such large InnoDB Buffer Pool Size".

Best Answer

When I go back to MySQL 5.5, I would think about this same thing.

What I learned over those years was the following: If the Buffer Pool was bigger than half the installed RAM and innodb_buffer_pool_instances was 1 (default for 5.5), the threat of swapping was always imminent.

I discussed this before : Is there a rule of thumb regarding the size and number of a buffer pool instances?. In that post, I mentioned an example of a client who had 192GB RAM on the server with 162GB Buffer Pool. When innodb_buffer_pool_instances was 1, swapping happened. When I set innodb_buffer_pool_instances to 2, things got way better.

In your case, since the Buffer Pool is exactly half, a value of 1 may be OK. I would not chance it. I would set it to 2.

Since MySQL 5.6 has a default of 8, you shouldn't have to think about it anymore.

I will say this: akuzminsky's answer has the highest principle. My answer is just shooting from hip based on past experiences (good and bad).