In this blog post, we’ll discuss how a small innodb_page_size can create a performance boost for SSD.
In my previous post Testing Samsung storage in tpcc-mysql benchmark of Percona Server I compared different Samsung devices. Most solid state drives (SSDs) use 4KiB as an internal page size, and the InnoDB default page size is 16KiB. I wondered how using a different
innodb_page_size might affect the overall performance.
Fortunately, MySQL 5.7 comes with the option
innodb_page_size, so you can set different InnoDB page sizes than the standard 16KiB. This option is still quite inconvenient to use, however. You can’t change
innodb_page_size for the existing database. Instead, you need to create a brand new database with a different
innodb_page_size and reload whole data set. This is a serious showstopper for production adoption. Specifying innodb_page_size for individual tables or indexes would be a welcome addition, and you could change it with a simple
ALTER TABLE foo page_size=4k.
Anyway, this doesn’t stop us from using
innodb_page_size=4k in the testing environment. Let’s see how it affects the results using the same conditions described in my previous post.
Again we see that the PM1725 outperforms the SM863 when we have a limited memory, and the result is almost equal when we have plenty of memory.
But what about
Here is a direct comparison chart:
Tabular results (in NOTPM, more is better):
|Buffer Pool, GiB||pm1725_16k||pm1725_4k||sam850_16k||sam850_4k||sam863_16k||sam863_4k||pm1725 4k/16k|
It’s interesting to see that 4k pages help to improve the performance up to 70%, but only for the PM1725 and SM863. For the low-end Samsung 850 Pro, using a 4k
innodb_page_size actually makes things worse when using a high amount of memory.
I think a 70% performance gain is too significant to ignore, even if manipulating
innodb_page_size requires extra work. I think it is worthwhile to evaluate if using different
innodb_page_size settings help a fast SSD under your workload.
And hopefully MySQL 8.0 makes it easier to use different page sizes!