MyRocks Storage Engine Status Update. Sergei Petrunia MariaDB Meetup New York February, 2018

Similar documents
MyRocks in MariaDB. Sergei Petrunia MariaDB Tampere Meetup June 2018

MariaDB Developer UnConference April 9-10 th 2017 New York. MyRocks in MariaDB. Why and How. Sergei Petrunia

How To Rock with MyRocks. Vadim Tkachenko CTO, Percona Webinar, Jan

Why Choose Percona Server For MySQL? Tyler Duzan

Replication features of 2011

Percona Server for MySQL 8.0 Walkthrough

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

MyRocks deployment at Facebook and Roadmaps. Yoshinori Matsunobu Production Engineer / MySQL Tech Lead, Facebook Feb/2018, #FOSDEM #mysqldevroom

MariaDB 10.3 vs MySQL 8.0. Tyler Duzan, Product Manager Percona

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

RocksDB Key-Value Store Optimized For Flash

Introduction to MySQL InnoDB Cluster

Everything You Need to Know About MySQL Group Replication

MyRocks Engineering Features and Enhancements. Manuel Ung Facebook, Inc. Dublin, Ireland Sept th, 2017

Percona Software & Services Update

MariaDB: Community Driven SQL Server. Kristian Nielsen MariaDB developer Monty Program AB

DHRUBA BORTHAKUR, ROCKSET PRESENTED AT PERCONA-LIVE, APRIL 2017 ROCKSDB CLOUD

Percona XtraDB Cluster MySQL Scaling and High Availability with PXC 5.7 Tibor Korocz

MySQL Multi-Source Replication

MySQL Replication: Latest Developments

Percona XtraDB Cluster

Percona Software & Services Update

MongoDB Storage Engine with RocksDB LSM Tree. Denis Protivenskii, Software Engineer, Percona

TokuDB vs RocksDB. What to choose between two write-optimized DB engines supported by Percona. George O. Lorch III Vlad Lesin

MySQL Replication Update

Why we re excited about MySQL 8

MySQL HA Solutions Selecting the best approach to protect access to your data

Beyond MySQL 5.1 What is happening in MySQL Space. Feb 16, 2011 Percona Live San Francisco,CA by Peter Zaitsev, Percona Inc

A Brief Introduction of TiDB. Dongxu (Edward) Huang CTO, PingCAP

G a l e r a C l u s t e r Schema Upgrades

The Exciting MySQL 5.7 Replication Enhancements

MySQL High Availability

What s New in MySQL and MongoDB Ecosystem Year 2017

How Percona Contributes to Open Source Database Ecosystem. Peter Zaitsev 5 October 2016

Distributed PostgreSQL with YugaByte DB

ProxySQL - GTID Consistent Reads. Adaptive query routing based on GTID tracking

MySQL High Availability Solutions. Alex Poritskiy Percona

Improvements in MySQL 5.5 and 5.6. Peter Zaitsev Percona Live NYC May 26,2011

Upgrading MySQL Best Practices. Apr 11-14, 2011 MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

MariaDB CeBIT MariaDB 10.1: Datenbankverschlüsselung und andere Sicherheitsvorteile. Jens Bollmann, Principal Instructor/Consultant

Lessons from database failures

Percona Software & Services Update

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

Migrating to Aurora MySQL and Monitoring with PMM. Percona Technical Webinars August 1, 2018

High availability with MariaDB TX: The definitive guide

MySQL Replication. Rick Golba and Stephane Combaudon April 15, 2015

MySQL Group Replication in a nutshell

Oracle Exam 1z0-883 MySQL 5.6 Database Administrator Version: 8.0 [ Total Questions: 100 ]

CO MySQL for Database Administrators

Consistent Reads Using ProxySQL and GTID. Santa Clara, California April 23th 25th, 2018

What s new in Percona Xtradb Cluster 5.6. Jay Janssen Lead Consultant February 5th, 2014

New Contributor Tutorial and Best Practices

Setting up Multi-Source Replication in MariaDB 10.0

Automatic MySQL Schema Management with Skeema. Evan Elias Percona Live, April 2017

Galera in MariaDB 10.4 State of the Art and Plans

Mike Kania Truss

Overview of Transaction Management

FUJITSU Cloud Service S5 Installation and Configuration of MySQL on a CentOS VM

NoVA MySQL October Meetup. Tim Callaghan VP/Engineering, Tokutek

Binlog Servers at Booking.com. Jean-François Gagné jeanfrancois DOT gagne AT booking.com

Switching to Innodb from MyISAM. Matt Yonkovit Percona

Continuous MySQL Restores Divij Rajkumar

InnoDB Scalability Limits. Peter Zaitsev, Vadim Tkachenko Percona Inc MySQL Users Conference 2008 April 14-17, 2008

ITS. MySQL for Database Administrators (40 Hours) (Exam code 1z0-883) (OCP My SQL DBA)

FromDual Annual Company Meeting

The Hazards of Multi-writing in a Dual-Master Setup

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona

How TokuDB Fractal TreeTM. Indexes Work. Bradley C. Kuszmaul. MySQL UC 2010 How Fractal Trees Work 1

Binlog Servers (and MySQL) at Booking.com. Jean-François Gagné jeanfrancois DOT gagne AT booking.com Presented at Percona Live Santa Clara 2015

Scale out Read Only Workload by sharing data files of InnoDB. Zhai weixiang Alibaba Cloud

Effective Testing for Live Applications. March, 29, 2018 Sveta Smirnova

Open Source Database Ecosystem in Peter Zaitsev 3 October 2016

MySQL Replication Advanced Features In 20 minutes

Split your database. Nicolai Plum Booking.com Database Engineering

MySQL usage of web applications from 1 user to 100 million. Peter Boros RAMP conference 2013

Load Testing Tools. for Troubleshooting MySQL Concurrency Issues. May, 23, 2018 Sveta Smirnova

POLARDB for MyRocks Extending shared storage to MyRocks. Zhang, Yuan Alibaba Cloud Apr, 2018

What are Transactions? Transaction Management: Introduction (Chap. 16) Major Example: the web app. Concurrent Execution. Web app in execution (CS636)

MySQL Group Replication. Bogdan Kecman MySQL Principal Technical Engineer

mysql Certified MySQL 5.0 DBA Part I

MySQL Database Administrator Training NIIT, Gurgaon India 31 August-10 September 2015

Review Version Control Concepts

MySQL Database Scalability

Percona Live September 21-23, 2015 Mövenpick Hotel Amsterdam

What is MariaDB 5.5? w: e: Daniel Bartholomew Oct 2012

Jailbreaking MySQL Replication Featuring Tungsten Replicator. Robert Hodges, CEO, Continuent

Transaction Management: Introduction (Chap. 16)

contribution-guide.org Release

Kenny Gryp. Ramesh Sivaraman. MySQL Practice Manager. QA Engineer 2 / 60

MySQL 5.7 For Operational DBAs an Introduction. Peter Zaitsev, CEO, Percona February 16, 2016 Percona Technical Webinars

Enabling and Optimizing MariaDB on Qualcomm Centriq 2400 Arm-based Servers

MySQL 8.0: Atomic DDLs Implementation and Impact

Why Choose Percona Server for MongoDB? Tyler Duzan

Backup & Restore. Maximiliano Bubenick Sr Remote DBA

MySQL Replication : advanced features in all flavours. Giuseppe Maxia Quality Assurance Architect at

Riding the Binlog: an in Deep Dissection of the Replication Stream. Jean-François Gagné jeanfrancois DOT gagne AT booking.com

Which technology to choose in AWS?

PebblesDB: Building Key-Value Stores using Fragmented Log Structured Merge Trees

Percona XtraDB Cluster 5.7 Enhancements Performance, Security, and More

Transcription:

MyRocks Storage Engine Status Update Sergei Petrunia <sergey@mariadb.com> MariaDB Meetup New York February, 2018

2 Plan What MyRocks is How it is provided in upstream Packaging MyRocks in MariaDB MyRocks for non-myrocks users.

What is MyRocks 3 (See other talks for a long answer) Short answer: Better compression Better (lower) write amplification Less SSD wear Higher write throughput Developed and used @ Facebook

4 Plan What MyRocks is How it is provided in upstream Packaging MyRocks in MariaDB MyRocks for non-myrocks users.

5 MyRocks lives in Facebook s MySQL branch github.com/facebook/mysql-5.6 Will call this FB/MySQL MyRocks lives there in storage/rocksdb FB/MySQL is easy to use if you are Facebook Not so easy if you are not

6 FB/mysql-5.6 user perspective No binaries, no packages Compile yourself from source Dependencies, etc. No releases (Is the latest git revision ok?) Has extra features e.g. extra counters confuse monitoring tools.

7 FB/mysql-5.6 dev perspective Targets a CentOS-type OS Compiler, cmake version, etc. Others may or may not [periodically] work MariaDB/Percona file pull requests to fix Special command to compile https://github.com/facebook/mysql-5.6/wiki/build-steps Special command to run tests Test suite assumes a big machine Some tests even a release build

8 Bringing MyRocks to a wider audience Two porting efforts MariaDB 10.2 Percona Server 5.7 Porting considerations Providing Packages Changing in-house experience to be user-friendlier Decoupling from FB-only features Coupling with features of your version (MariaDB 10.2 or MySQL 5.7)

9 Plan What MyRocks is How it is provided in upstream Putting MyRocks into MariaDB MyRocks for non-myrocks users.

10 MyRocks in MariaDB MyRocks is a loadable plugin with its own Maturity level. Available in MariaDB 10.2+ MyRocks itself is the same across 10.2 and 10.3 New related feature in 10.3: Per-engine mysql.gtid_slave_pos Releases April, 2017: MyRocks is Alpha (added to MariaDB 10.2.5 RC) January, 2018: MyRocks is Beta (very soon): MyRocks is RC

11 Keeping up to date with FB/MySQL MyRocks continues to evolve @ Facebook New changes are periodically merged into MariaDB Merge tree approach Can view the merge status at https://github.com/mariadb/mergetrees/commits/merge-myrocks Merging is still a manual process But the amount of effort is reasonable

12 Plan What MyRocks is How it is provided in upstream Putting MyRocks into MariaDB Packaging MyRocks MyRocks for non-myrocks users.

Zlib Snappy 13 MyRocks and RocksDB library MyRocks is tied RocksDB@revno RocksDB is a github submodule No compatibility with other versions RocksDB is compiled together with MyRocks And linked-in statically Distros have a RocksDB package MariaDB MyRocks RocksDB Not using it.

Zlib Snappy 14 Compression libraries RocksDB uses compression libraries Snappy, Zlib, Bzip, LZ4, ZStandard Distros strongly prefer you to use OS packages e.g. don t ship your own bzip MariaDB s MyRocks package has proper dependencies. MariaDB MyRocks RocksDB

MariaDB s MyRocks package Package: mariadb-plugin-rocksdb Source: mariadb-10.3 Version: 10.3.5+maria~artful Architecture: amd64 Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net> Installed-Size: 13227 Depends: mariadb-server-10.3 (= 10.3.5+maria~artful), libc6 (>= 2.17), liblz4-1 (>= 0.0~r130), libsnappy1v5, libstdc++6 (>= 7), zlib1g (>= 1:1.1.4) Recommends: python-mysqldb Breaks: mariadb-rocksdb-engine-10.2, mariadb-rocksdb-engine-10.3 Replaces: mariadb-rocksdb-engine-10.2, mariadb-rocksdb-engine-10.3 Section: database Priority: optional Homepage: http://mariadb.org/ Description: RocksDB storage engine for MariaDB... 15 *** Contents: 0 2018-02-23 13:42./ 0 2018-02-23 13:42./etc/ 0 2018-02-23 13:42./etc/mysql/ 0 2018-02-23 13:42./etc/mysql/mariadb.conf.d/ -rw-r--r-- root/root 40 2018-02-23 13:42./etc/mysql/mariadb.conf.d/rocksdb.cnf 0 2018-02-23 13:42./usr/ 0 2018-02-23 13:42./usr/bin/ -rwxr-xr-x root/root 24704 2018-02-23 11:01./usr/bin/myrocks_hotbackup -rwxr-xr-x root/root 4103224 2018-02-23 13:42./usr/bin/mysql_ldb -rwxr-xr-x root/root 4094992 2018-02-23 13:42./usr/bin/sst_dump 0 2018-02-23 13:42./usr/lib/ 0 2018-02-23 13:42./usr/lib/mysql/ 0 2018-02-23 13:42./usr/lib/mysql/plugin/ -rw-r--r-- root/root 5298792 2018-02-23 13:42./usr/lib/mysql/plugin/ha_rocksdb.so 0 2018-02-23 13:42./usr/share/ 0 2018-02-23 13:42./usr/share/doc/ 0 2018-02-23 13:42./usr/share/doc/mariadb-plugin-rocksdb/ -rw-r--r-- root/root 513 2018-02-23 13:42./usr/share/doc/mariadb-plugin-rocksdb/changelog.gz -rw-r--r-- root/root 2501 2018-02-23 11:01./usr/share/doc/mariadb-plugin-rocksdb/copyright

Compare with Percona Server s package 16 Package: percona-server-rocksdb-5.7 Source: percona-server-5.7 Version: 5.7.21-20-1.trusty Architecture: amd64 Maintainer: Percona Server Development Team <mysql-dev@percona.com> Installed-Size: 132079 Depends: percona-server-server-5.7 (= 5.7.21-20-1.trusty) Section: database Priority: extra Homepage: http://www.percona.com/software/percona-server/ Description: MyRocks storage engine plugin for Percona Server. MyRocks is a storage engine for Percona Server which incorporates RocksDB library optimized for fast storage and space efficiency.. This package includes the MyRocks/RocksDB plugin library. No dependencies They bundle lz4 and zstd *** Contents: 0 2018-02-16 14:00./ 0 2018-02-16 14:00./usr/ 0 2018-02-16 14:00./usr/share/ 0 2018-02-16 14:00./usr/share/doc/ 0 2018-02-16 14:00./usr/share/doc/percona-server-rocksdb-5.7/ -rw-r--r-- root/root 1959 2018-02-16 10:57./usr/share/doc/percona-server-rocksdb-5.7/copyright -rw-r--r-- root/root 781 2018-02-16 12:35./usr/share/doc/percona-server-rocksdb-5.7/changelog.Debian.gz 0 2018-02-16 14:01./usr/bin/ -rwxr-xr-x root/root 5539400 2018-02-16 14:01./usr/bin/sst_dump -rwxr-xr-x root/root 5547592 2018-02-16 14:01./usr/bin/ldb -rwxr-xr-x root/root 5551688 2018-02-16 14:01./usr/bin/mysql_ldb 0 2018-02-16 13:57./usr/lib/ 0 2018-02-16 13:57./usr/lib/mysql/ 0 2018-02-16 14:01./usr/lib/mysql/plugin/ -rw-r--r-- root/root 7095880 2018-02-16 14:01./usr/lib/mysql/plugin/ha_rocksdb.so 0 2018-02-16 13:57./usr/lib/mysql/plugin/debug/ -rw-r--r-- root/root 111465379 2018-02-16 13:03./usr/lib/mysql/plugin/debug/ha_rocksdb.so

Plan 17 What MyRocks is How it is provided in upstream Putting MyRocks into MariaDB Packaging MyRocks MyRocks for non-myrocks users Data loading Replication Backup

Plan 18 MyRocks for non-myrocks users Data loading Replication Backup

19 Data loading good news It s a write-optimized storage engine The same data takes less space on disk Data loading is faster Do not have my own benchmark data, yet See Facebook s talks

20 Data loading bad news Limitation: Transaction must fit in memory mysql> ALTER TABLE big_table ENGINE=RocksDB; ERROR 2013 (HY000): Lost connection to MySQL server during query Need to use special settings for loading data mysql> set rocksdb_bulk_load=1; See https://github.com/facebook/mysql-5.6/wiki/data-loading Some settings make behavior non-transactional

21 Safety settings Avoid run-away memory usage and OOM killer: mysql> set rocksdb_max_row_locks=10000; mysql> alter table t10 engine=rocksdb; ERROR 4067 (HY000): Status error 10 received from RocksDB: Operation aborted: Failed to acquire lock due to max_num_locks limit This is useful after data loading, too.

Plan 22 MyRocks for non-myrocks users Data loading Replication Backup

23 MyRocks only supports Row-Based MyRocks highest isolation level is snapshot isolation, that is REPEATABLE-READ Statement-Based Replication: slave will run statements sequentially (serializable). Because of this, MyRocks doesn t support SBR. Row-Based Replication must be used.

Gap Lock Detector 24 InnoDB supports SBR due to having Gap Locking FB/MySQL has Gap Lock Detector Detect queries that ought to do gap locking Log/fail them MariaDB doesn t have it (SQL level feature) Percona Server does have it and always returns errors: # log_bin=1, binlog_format=row # optionally : set sql_log_bin=0; set rocksdb_bulk_load=1; MySQL [test]> insert into t2 select * from t1; ERROR 1105 (HY000): Using Gap Lock without full unique key in multi-table or multi-statement transactions is not allowed. You need to either rewrite queries to use all unique key columns in WHERE equal conditions, or rewrite to single-table, single-statement transaction. Query: insert into t2 select * from t1

25 Parallel replication FB/MySQL-5.6 is based on MySQL 5.6 Parallel replication is for different databases MariaDB has more advanced parallel slave Conservative (group-commit based) Optimistic (rolling back conflicting transactions)

26 Conservative mode works MariaDB s Group Commit works on the master Slave runs in parallel Note: different write path depending on log_slave_updates ON: Does XA with slave binlog OFF: Commit in order, in parallel Both now work, but different under the hood.

27 Optimistic parallel replication Requires support for High-priority transactions : We apply trx1 trx1 needs a lock that trx2 is holding? Roll back trx2. MyRocks doesn t provide this feature Can run with slave_parallel_mode=optimistic But it does not provide [much] advantage over conservative.

28 Background: mysql.gtid_slave_pos mysql.gtid_slave_pos stores slave s position Store it in a transactional storage engine After crash, we know the relay log position that matches the data It s a crash-safe slave mysql.gtid_slave_pos uses a different engine? Cross-engine transaction (slow).

29 Per-engine mysql.gtid_slave_pos The idea: Have mysql.gtid_slave_pos_${engine} for each engine Slave position is the biggest position in all tables. Transaction affecting only MyRocks will only touch mysql.gtid_slave_pos_rocksdb Configuration: --gtid-pos-auto-engines=engine1,engine2,...

30 Per-engine mysql.gtid_slave_pos Available in MariaDB 10.3 Thanks for the patch to Kristian Nielsen (implementation) Booking.com (request and funding) In MariaDB 10.2: ALTER TABLE mysql.gtid_slave_pos ENGINE=RocksDB;

31 Read-Free Replication Special replication modes FB/MySQL has it Percona Server has it (for TokuDB initially) MariaDB (currently) doesn t rpl_skip_tx_api Server-level feature in FB/MySQL Percona Server: MyRocks-specific port MariaDB doesn t have it Master-skip-tx-api Only FB/MySQL has it (recent addition).

Plan 32 MyRocks for non-myrocks users Data loading Replication Backup

33 Backup for MyRocks FB/MySQL Includes myrocks_hotbackup Percona Server Doesn t include it, points to FB s myrocks_hotbackup MariaDB Includes a [slightly] modified myrocks_hotbackup Mariabackup doesn t support MyRocks [yet?]

34 myrocks_hotbackup under the hood Operation Take a RocksDB snapshot (hard link the sst files) Transfer it to backup destination Copy the.frm and other supplementary files Don t copy InnoDB and other files For the user Works on a controlled MyRocks-only instance Not user-friendly.

Conclusions 35

36 MyRocks is RC in MariaDB Aiming for GA soon MariaDB s improvements Conclusions Proper packages Conservative Parallel slave Per-engine mysql.gtid_slave_pos (10.3) Using MyRocks Can get better space/write efficiency And performance for write-heavy workloads However one has to use special settings.

Thanks! 37