Using TerarkDB to improve the performance of MyRocks
——MySQL performance optimization in random read scenarios
Lei Peng@
CTO
Outline
l Introduction to MyRocks
l Why MyRocks
l Block Compression for Traditional Databases
l Hardware Development Trend
l The relationship between TerarkDB and MyRocks
l The principle, advantages and disadvantages of TerarkDB
l New problems, and optimization suggestions
Introduction to MyRocks
l MyRocks=MySQL+RocksDB (storage engine)
l Based on MySQL-5.6 : code (MySQL onTerarkDB)
Ø Added some MySQL-5.7 Features
Ø Added some syntax and functions specific to RocksDB
Ø Some functions do not support,details See :MyRocks-limitations
l Learn more about MyRocks :MyRocks DeepDive
MyRocks main functions
l InnoDB-like functions
l Transaction
Ø Based on MVCC
Ø ReadCommitted, RepeatableRead(PostgreSQL-style)
l Online Backup
Ø Logical backup (using mysqldump)
Ø Binary backup (using myrocks_hotbackup)
Why choose MyRocks
l mature and stable,meets most functional requirements
l Use a single DB, suitable for cloud DB multi-tenant scenarios
l Based on RocksDB, directly compatible with TerarkDB
l Based on LSM,Yes SSD friendly
Traditional databases all use block compression——
l InnoDB
l LevelDB/RocksDB…
l TukoDB
Block compression has an insurmountable ,
l WiredTiger inherent flaw ,
l Cassandra/ScyllaDB let’s see how it works& #xff0c;
l CouchDB analysis –
l HBase
l …
Principle of block compression
l Multiple pieces of data are packed into one block , the index locates the block
Ø Increase the size of the block : the index is smaller , the number of data pieces in a single block is more , invalid decompression more
Ø reduced block : index larger , compression algorithm not working efficiently , less compression
l Block cache DirectIO leads to only
problem 1
decompressed data , a certain process
too slow——
Ø Decompress a block for each access ,
Reduced memory utilization to a certain extent
Ø Put the decompressed block into the cache
p>Problem 2 DirectIO requires aligned access ,
Ø The operating system also has a file cache double-buffer problem!
Using DirectIO requires cross-boundary in the worst case
(compressed data is stored in the file) Read two more blocks
The development trend of hardware
l The capacity/price of the mechanical hard disk still has a huge advantage
Ø More resistant to writing,safer;helium hard drive,HAMR technology…
l SSD is getting cheaper,NVMe/ PCIe has been widely used
Ø It is not resistant to writing , If the data is damaged, it will be permanently lost
Ø SSD with NVMe/PCIe interface is faster,lower latency
l 3DXPoint , is faster than SSD, more resistant to writing
Ø The first generation product Optane (Flash Teng) is already on the market!
Ø Using DIMM interface , can be used as memory…
Development trend of hardware
Bandwidth (MB/s) IOPS Latency (us) Access granularity