InnoDB computes the checksum for pages of compressed tables every time the page is decompressed. For uncompressed tables the checksum on the read path is only computed when the page is read from disk. The extra checksum computations use extra CPU and bug 64170 has the details.
Page compression and decompression also require a large memory buffer (~500kb) that is allocated and deallocated during one function call via calls to malloc and free. I think some of these calls are done when the index lock is locked so this can be a bottleneck.
While debugging a few servers that were short on CPU we noticed there were too many threads spinning on malloc mutexes. We don't yet use the awesome jemalloc so we changed InnoDB to use a small heap cache to avoid the frequent large malloc calls. I have yet to file a feature request at bugs.mysql.com for that.
There is another point in the code where InnoDB might call malloc and free when the buffer pool mutex is locked to allocate descriptors for pages of compressed tables. We added another heap cache to reduce the number of calls to malloc and free. Feature request 64344 is open for this.
A modified version of sysbench was run using four configurations for MySQL that includes the changes described here.
- checksum0_malloc0 - avoid extra checksums, don't reduce malloc calls
- checksum0_malloc1 - avoid extra checksums, reduce malloc calls
- checksum1_malloc0 - allow extra checksums, don't reduce malloc calls
- checksum1_malloc1 - allow extra checksums, reduce malloc calls
This lists QPS for 8 to 128 concurrent clients. A graph of the results is here. The results for checksum0_malloc1 include all of our changes. The results for checksum1_malloc0 include none of our changes. There is a significant difference between them but I think I need to spend more time figuring out the worst-case workload that makes these changes interesting.
8 16 32 64 128 concurrent clients
662 1289 1369 1407 1426 checksum0_malloc0
843 1382 1474 1495 1525 checksum0_malloc1
696 1248 1341 1377 1366 checksum1_malloc0
827 1316 1419 1430 1462 checksum1_malloc1
PlanetMySQL Voting: Vote UP / Vote DOWN