Top Banner
MySQL Storage Engines Which Do You Use? April, 25, 2017 Sveta Smirnova
61

MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

Jan 21, 2018

Download

Software

Sveta Smirnova
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

MySQL Storage EnginesWhich Do You Use?

April, 25, 2017Sveta Smirnova

Page 2: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL Support engineer• Author of

• MySQL Troubleshooting• JSON UDF functions• FILTER clause for MySQL

• Speaker• Percona Live, OOW, Fosdem,

DevConf, HighLoad...

Sveta Smirnova

2

Page 3: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM

• Version 3.23 introduced table types• In year 2003 term ”Type” was deprecated• Engines were built-in into server• Nobody could deliver engine independently• Version 5.1 changed everything

• Pluggable storage engine API was introduced

From Type to Engine

3

Page 4: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM• Version 3.23 introduced table types

mysql> CREATE TABLE plmce(

-> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

-> name VARCHAR(100)

-> ) TYPE = MyISAM;

Query OK, 0 rows affected, 1 warning (0.10 sec)

• In year 2003 term ”Type” was deprecated• Engines were built-in into server• Nobody could deliver engine independently• Version 5.1 changed everything

• Pluggable storage engine API was introduced

From Type to Engine

3

Page 5: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM• Version 3.23 introduced table types• In year 2003 term ”Type” was deprecated

• Engines were built-in into server• Nobody could deliver engine independently• Version 5.1 changed everything

• Pluggable storage engine API was introduced

From Type to Engine

3

Page 6: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM• Version 3.23 introduced table types• In year 2003 term ”Type” was deprecated• Engines were built-in into server

• Nobody could deliver engine independently• Version 5.1 changed everything

• Pluggable storage engine API was introduced

From Type to Engine

3

Page 7: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM• Version 3.23 introduced table types• In year 2003 term ”Type” was deprecated• Engines were built-in into server• Nobody could deliver engine independently

• Version 5.1 changed everything• Pluggable storage engine API was introduced

From Type to Engine

3

Page 8: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL < 3.23 had only engine: ISAM• Version 3.23 introduced table types• In year 2003 term ”Type” was deprecated• Engines were built-in into server• Nobody could deliver engine independently• Version 5.1 changed everything

• Pluggable storage engine API was introduced

From Type to Engine

3

Page 9: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Part of MySQL since version 3.23.24• Released at March, 10, 2001

• Created by Innobase OY• Major changes in 5.1

InnoDB

4

Page 10: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Part of MySQL since version 3.23.24• Created by Innobase OY

• Acquired by Oracle in 2005

• Major changes in 5.1

InnoDB

4

Page 11: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Part of MySQL since version 3.23.24• Created by Innobase OY• Major changes in 5.1

• New tablespace format• Dynamic loading• Online index creation• ...• Released as a plugin

InnoDB

4

Page 12: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Part of MySQL since version 3.23.24• Created by Innobase OY• Major changes in 5.1

• Two versions in 5.1.38 - 5.1.73Built-inPluggable

InnoDB

4

Page 13: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Many others started own storage engines

• Most notable• Tokutek

TokuDBWrite-scaleAcquired by Percona in 2015

• Primebase

PBXTBetter BLOB handling technologyEngine not supported now

Pioneers

5

Page 14: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Many others started own storage engines• Most notable

• Tokutek

TokuDBWrite-scaleAcquired by Percona in 2015

• Primebase

PBXTBetter BLOB handling technologyEngine not supported now

Pioneers

5

Page 15: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Many others started own storage engines• Most notable

• TokutekTokuDBWrite-scaleAcquired by Percona in 2015

• Primebase

PBXTBetter BLOB handling technologyEngine not supported now

Pioneers

5

Page 16: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Many others started own storage engines• Most notable

• TokutekTokuDBWrite-scaleAcquired by Percona in 2015

• PrimebasePBXTBetter BLOB handling technologyEngine not supported now

Pioneers

5

Page 17: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Built-in engines were converted into plugins• Some old engines were removed

• BerkeleyDB• ISAM

In the Official Distribution

6

Page 18: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Number of engine grows• They can

• Shard: Spider• Use any source of data: CONNECT• Connect to foreign sources: FederatedX• Perform full text search: SphinxSE• More

• MariaDB includes most of the engines

Community

7

Page 19: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All engines• Store data• Retrieve data

• Simple engines• Complex engines

• ImplementOwn locking modelTransactionsDiagnosticLog filesMore

Simple and Complex Engines

8

Page 20: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All engines• Simple engines

• Use built-ins for all other jobLockingTransactions supportDiagnostic

• Complex engines• Implement

Own locking modelTransactionsDiagnosticLog filesMore

Simple and Complex Engines

8

Page 21: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All engines• Simple engines• Complex engines

• ImplementOwn locking modelTransactionsDiagnosticLog filesMore

Simple and Complex Engines

8

Page 22: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All three• Transactional• Row-level locking• MVCC• ACID• XA• Automatic crash recovery

• InnoDB• TokuDB• MyRocks

Three Majors: InnoDB, TokuDB, MyRocks

9

Page 23: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All three• InnoDB

• Universal• Default since 5.5.5

• TokuDB• MyRocks

Three Majors: InnoDB, TokuDB, MyRocks

9

Page 24: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All three• InnoDB• TokuDB

• Write optimized• Fine compression support• Best for big data

• MyRocks

Three Majors: InnoDB, TokuDB, MyRocks

9

Page 25: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• All three• InnoDB• TokuDB• MyRocks

• Write and space optimized• Great compression support• Best for SSD

Three Majors: InnoDB, TokuDB, MyRocks

9

Page 26: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• B-Tree• Extremely fast read access• Needs to be re-balanced on write

• Reach features set• Foreign keys• Locks at the engine level

RowGapAuto-incrementTable

• Compression• Extended crash recovery

InnoDB

10

Page 27: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• B-Tree• Reach features set

• Foreign keys• Locks at the engine level

RowGapAuto-incrementTable

• Compression• Extended crash recovery

InnoDB

10

Page 28: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Initial Data11

/ \10 12/ \

2 24/ \ / \

1 9 23 25

• INSERT 5

B-Tree

11

Page 29: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• SELECT 1111

/ \10 12/ \

2 24/ \ / \

1 9 23 25

• INSERT 5

B-Tree

11

Page 30: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• SELECT 1011

/ \10 12/ \

2 24/ \ / \

1 9 23 25

• INSERT 5

B-Tree

11

Page 31: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• SELECT 211

/ \10 12/ \

2 24/ \ / \

1 9 23 25

• INSERT 5

B-Tree

11

Page 32: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• SELECT 911

/ \10 12/ \

2 24/ \ / \

1 9 23 25

• INSERT 5

B-Tree

11

Page 33: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 511

/ \10 12/ \

2 24/ \ / \

1 5 9 23 25

B-Tree

11

Page 34: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 511

/ \10 12/ \

2 24/ \ / \

1 5 9 23 25

B-Tree

11

Page 35: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 511

/ \10 12/ \

2 24/ \ / \

1 5 9 23 25

B-Tree

11

Page 36: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 511

/ \9 10 12

/ \2 24

/ \ / \1 5 23 25

B-Tree

11

Page 37: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 510 11

/ \9 12

/ \2 24

/ \ / \1 5 23 25

B-Tree

11

Page 38: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• INSERT 510

/ \9 12

/ / \2 11 24

/ \ / \1 5 23 25

B-Tree

11

Page 39: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Fractal Tree• Write optimized• All writes stored in buffers• Background thread flushes them• By default reads are slow

• Optimizations for reads• Optimizations for writes• Other features and limitations

• Reach set of locking diagnostic• No foreign key support• Crash recovery is limited if compare to

InnoDB

TokuDB

12

Page 40: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Fractal Tree• Optimizations for reads

• Secondary Clustered Indexes• Read-free replication• No index fragmentation

• Optimizations for writes• Other features and limitations

• Reach set of locking diagnostic• No foreign key support• Crash recovery is limited if compare to

InnoDB

TokuDB

12

Page 41: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Fractal Tree• Optimizations for reads• Optimizations for writes

• Fast inserts• Bulk loader• Compression

• Other features and limitations• Reach set of locking diagnostic• No foreign key support• Crash recovery is limited if compare to

InnoDB

TokuDB

12

Page 42: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• Fractal Tree• Optimizations for reads• Optimizations for writes• Other features and limitations

• Reach set of locking diagnostic• No foreign key support• Crash recovery is limited if compare to

InnoDB

TokuDB

12

Page 43: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Write and space optimized• All writes go to MemTable and WAL first• Data files are immutable• Compaction• Designed for small transactions

• Optimizations for reads• Optimizations for writes• Limitations

• Two transaction isolation levels

• No gap locking• No support for• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 44: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads

• Bloom filter• ICP• No ”index dives”• Reverse column families• Read-free replication

• Optimizations for writes• Limitations

• Two transaction isolation levels

• No gap locking• No support for• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 45: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads• Optimizations for writes

• Options for bulk operations• Compression

• Limitations• Two transaction isolation levels

• No gap locking• No support for• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 46: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads• Optimizations for writes• Limitations

• Two transaction isolation levelsREAD COMMITTEDREPEATABLE READ

• No gap locking• No support for• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 47: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads• Optimizations for writes• Limitations

• Two transaction isolation levels• No gap locking• No support for

Foreigh KeysFull Text KeysSpatial Keys

• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 48: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads• Optimizations for writes• Limitations

• Two transaction isolation levels• No gap locking• No support for• Index only access for limited types

BINARYCollation latin1 binCollation utf8 bin

• Crash recovery is limited

MyRocks

13

Page 49: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• LSM Tree• Optimizations for reads• Optimizations for writes• Limitations

• Two transaction isolation levels• No gap locking• No support for• Index only access for limited types• Crash recovery is limited

MyRocks

13

Page 50: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

InnoDB TokuDB MyRocks

Reads Fast Slow Slow

Writes Comparatively Slow Fast Fast

Transaction Isolation Levels 4 4 2 (RR, RC)

Foreign Keys Yes Not Not

Space Used Plenty Workload-depend Small

Compression Yes Yes Yes

Crash Recovery Automatic, Tunable Automatic Automatic

Three Majors: comparison

14

Page 51: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• MySQL has many storage engines• They provide a lot of flexibility• Many extend server functionality• Simple and complex engines exist• InnoDB is feasible for most workloads• TokuDB and MyRocks are best for write

intensive applications

Summary

15

Page 52: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• MyRocks Engineering: deploying a new

MySQL storage engine to production• Herman Lee

• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 53: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203

• EVCache: Lowering Costs for a Low-LatencyCache with RocksDB

• Scott Mansfield

• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 54: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C

• MyRocks: best practice at Alibaba• dengcheng he, jiayi wang

• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 55: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203

• Six New Important RocksDB Features AndPlanned Works

• Siying Dong

• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 56: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E

• Using SPIDER for sharding in production• Kayoko GOTO, Kentoku SHIBA

• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 57: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E

• MariaRocks: MyRocks in MariaDB• Sergei Petrunia

• April, 27, 1:50pm, Ballroom A

MySQL Storage Engine Sessions at Percona Live

16

Page 58: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

• April, 25, 5:15pm, Balroom B• April, 26, 11:10am, Room 203• April, 26, 2:00pm, Balroom C• April, 26, 2:00pm, Room 203• April, 26, 4:30pm, Ballroom E• April, 27, 11:00am, Ballroom E• April, 27, 1:50pm, Ballroom A

• TokuDB vs RocksDB• George Lorch, Vladislav Lesin

MySQL Storage Engine Sessions at Percona Live

16

Page 60: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

???

Time For Questions

18

Page 61: MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?

http://www.slideshare.net/SvetaSmirnova

https://twitter.com/svetsmirnova

Thank you!

19