xtradb 5.6 and 5.7: key performance algorithms

32
Laurynas Biveinis Alexey Stroganov Percona Live 2015 XtraDB 5.6 & 5.7: Key Performance Algorithms

Upload: laurynas-biveinis

Post on 17-Jul-2015

295 views

Category:

Software


0 download

TRANSCRIPT

Laurynas Biveinis Alexey Stroganov

Percona Live 2015

XtraDB 5.6 & 5.7: Key Performance Algorithms

www.percona.com‹#›

Agenda

InnoDB and XtraDB

5.5, 5.6, 5.7

Algorithms

Performance

www.percona.com‹#›

InnoDB 5.5: Buffer Pool Data Structures

www.percona.com‹#›

InnoDB 5.5 solution for the mutex contention

www.percona.com‹#›

XtraDB 5.5 solution for the mutex contention

www.percona.com‹#›

It’s OK to combine the solutions

www.percona.com‹#›

InnoDB 5.5: trx sys trx list

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 XtraDB 5.6 vs XtraDB 5.5

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‹#›

Buffer Pool Concurrency, 5.5

www.percona.com‹#›

Buffer Pool Concurrency, 5.6

www.percona.com‹#›

InnoDB 5.6: page cleaner thread

Flushing concentrated there

But does it run?

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‹#›

High checkpoint age

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.6: serialized flushing modes

Busy cleaner thread:

www.percona.com‹#›

XtraDB 5.6: two-threaded flushing

Greatly simplifies heuristics as well

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‹#›

Buffer pool instance access non-uniformity

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

www.percona.com‹#›

sysbench/OLTP_RW