xtradb 5.6 and 5.7: key performance algorithms
TRANSCRIPT
www.percona.com‹#›
XtraDB 5.5: trx sys trx list
http://bugs.mysql.com/bug.php?id=49169, https://dev.mysql.com/worklog/task/?id=6578
h"p://bit.ly/pstrx1, h"p://bit.ly/pstrxdesc2
www.percona.com‹#›
Early 5.6: now what.
Buffer pool mutex contention
We have a patch, so we will be fine
Right?
www.percona.com‹#›
XtraDB 5.6: page cleaner thread
Prioritize it in the OS scheduler
Implemented in Oracle 5.7 too
www.percona.com‹#›
InnoDB 5.6: query thread flushing
LRU: single page flush
Flush list: sync preflush
Query thread flushing: cleaner in trouble
So let’s hurt it even more
www.percona.com‹#›
XtraDB 5.6: query thread flushing
Disabled
—innodb-empty-free-list-algorithm=backoff
—innodb-foreground-preflush=exponential_backoff
Preflush wait now in Oracle 5.7
www.percona.com‹#›
InnoDB 5.6: cleaner under load
Flushing taking > 1s, i.e. 60s…
And the other way around
Breaks adaptive flushing calculations
Long LRU flush prevents flush list flushing
www.percona.com‹#›
XtraDB 5.6: cleaner timeouts
Flushing iteration cannot exceed 1s
And the other flusher would run, if not for …
AF calculations OK
http://bugs.mysql.com/bug.php?id=70453
www.percona.com‹#›
InnoDB 5.7: serialised multi-threaded flushing
Cleaner
Worker
Worker
Worker
Request
Flush LRU
Flush LRU
Flush LRU Flush flush list
Flush flush list
Flush flush list
wait… wait… wait…
www.percona.com‹#›
Serialized Multi-threaded flushing
Multi-threaded, and
One more thing…
LRU and flush list flushing independent
No branch has implemented this ATM
www.percona.com‹#›
Buffer pool instance access non-uniformity
Mikael Ronstrom: “First the accesses to the buffer pools is in no way evenly spread out”
Flushing requests divided uniformly between the instances
Acknowledged at 5.5, confirmed in 5.6
5.7 addresses this, but only partially
www.percona.com‹#›
XtraDB 5.6: Buffer pool instance access non-uniformity
Instances with empty free lists get extra flushing
This is incomplete solution, but helps
www.percona.com‹#›
InnoDB 5.7: Buffer pool instance access non-uniformity
Flush list flush request distributed across instances
So that target LSN is reached everywhere
Is this enough (for the flush list)?
What about LRU?
www.percona.com‹#›
InnoDB 5.6: “free buffers 0”
Query thread needs a page
* - single page flush or sleep
Lock buffer pool or free list mutex
No free page, unlock, wait (*), goto 1
www.percona.com‹#›
InnoDB 5.6: “free buffers 0”
Query thread 1 needs a page
Cleaner has a page, does not have the mutex
Query thread 2 needs a page
Query thread 3 needs a page
www.percona.com‹#›
XtraDB 5.6: “free buffers 0”
Priority mutex framework
Regardless of the waiting query thread number
Cleaner thread gets the mutex first
Is able to put a page on the free list
www.percona.com‹#›
5.7 review
XtraDB InnoDB
+ crc32 for redo log 5.6 late 5.6
+ Read view creation 5.5 5.7
+ Cleaner thread prioritization 5.6 5.7
+ Sync preflush removal 5.6 5.7 (…)
+ Multi-threaded flushing 5.6 (two-threaded) 5.7 (…)
+ Non-uniform buffer pool instance flushing 5.6 (…) 5.7 (…)
+ Buffer pool mutex split 5.1+
+ Cleaner thread timeouts 5.6
+ Empty free list handling 5.6
+ Single page LRU-flush removal 5.6