SlideShare a Scribd company logo
Percona ServerをMySQL 5.6と5.7⽤用に作るエンジニアリング(そして
MongoDBのヒント)
Engineering that goes into making Percona Server for MySQL 5.6 & 5.7
different (and a hint of MongoDB)
Colin Charles, Chief Evangelist, Percona Inc.

colin.charles@percona.com / byte@bytebot.net 

http://bytebot.net/blog/ | @bytebot on Twitter 

db tech showcase Tokyo, Japan

6 September 2017
1
whoami
• Chief Evangelist, Percona Inc

• Focusing on the MySQL ecosystem (MySQL, Percona Server, MariaDB
Server), as well as the MongoDB ecosystem (Percona Server for
MongoDB) + 100% open source tools from Percona like Percona
Monitoring & Management, Percona xtrabackup, Percona Toolkit, etc.

• Founding team of MariaDB Server (2009-2016), previously at Monty
Program Ab, merged with SkySQL Ab, now MariaDB Corporation

• Formerly MySQL AB (exit: Sun Microsystems)

• Past lives include Fedora Project (FESCO), OpenOffice.org

• MySQL Community Contributor of the Year Award winner 2014
2
Agenda
• Percona’s Aims

• Developing a branch of MySQL

• Adding features that make a difference

• Custom development

• Tools

• Sustainable engineering going forward
3
Percona’s Purpose
Unbiasedオープンソースデータ
ベースソリューションを⽀支える
To Champion Unbiased Open
Source Database Solutions
4
Percona Software Principles
すべてのPerconaソフトウェアは100%無料料でオープンソースです
All Percona Software is 100% Free and Open Source
あなたが⽀支払う必要がある "エンタープライズ"バージョンはありません
No Restricted “Enterprise” version
オープンコアなし
No Open Core
いいえソフトウェアライセンスゲーム
No Software Licensing Games
5
6
Widely deployed Open Source Software
Aims
• ソフトウェアフォークではない

• Branch, not a fork

• オープンソースソフトウェアの独⾃自の部分に代わるものを提供する

• Provide alternatives to proprietary parts of open source
software

• 強⼒力力な運⽤用フォーカス:互換性、アプリケーションのスケーラビリ
ティ、⾼高可⽤用性、セキュリティ、可観測性

• Strong operations focus: compatibility, application scalability,
high availability, security, observability
7
History (or how it all began)
• Percona Server: 8 years old — November
2008 (Percona SQL, Percona highperf builds)

• November 2008: Percona Server (patchset
~July)
8
Timeline
• December 2010: MySQL 5.5 GA

• April 2011: Percona Server for MySQL GA

• February 2013: MySQL 5.6 GA

• October 2013: Percona Server for MySQL GA

• October 2015: MySQL 5.7 GA

• February 2016: Percona Server for MySQL GA
9
Straight from the docs
10
Software engineering
• ⼈人々が⽂文書内でコメントできる完全な仕様の設計⽂文書にリンクするリストに詳細な説明を書く

• Write a detailed description to a list linking to a full specification design document
where people can comment within the document

• 品質保証への公式ハンドオーバー(QA) 

• Official handover to quality assurance (QA)

• In addition to pquery tests, specify what requirements there are

• 設計⽂文書とリスト上で⾏行行われたすべての議論のおかげで⽂文書化が容易易になりました

• Documentation is made easier thanks to design document and all the discussions that
took place on list

• もちろん、ブログ!

• Blog, of course!
11
Development
• Jenkins

• Bazaar (Launchpad) and Git (Github)

• Jira (MyRocks)

• パブリックリストは、開発ではなくエンドユー
ザーサポートのための

• Public lists are still more for end user support
rather than development
12
Percona XtraDB - buffer pool, I/O scalability
• SHOW ENGINE INNODB STATUS extended output

• バッファプールを保護するグローバルミューテックスは、競合を減らすた
めに複数のmutexに分割されています。ワーキングセットがメモリに収まら
ない場合

• Global mutex protecting the buffer pool has been split into several
mutexes to decrease contention - good when working set doesn’t fit in
memory

• ログブロックサイズを変更更するには、innodb_flush_method =
ALL_O_DIRECT

• Change the log block size, innodb_flush_method=ALL_O_DIRECT
13
Percona XtraDB - I/O bound, concurrent
workloads
• レガシーダブルライトバッファは、すべてのページ書き込み要求を1つのバッ
ファに集めます。書き込みが完了了すると、新しい書き込み要求をブロックして2
回ディスクに書き出します。 ボトルネックで洗練された並列列性。

• Legacy doublewrite buffer collects all page write requests into a single buffer,
when filled, writes it out to disk twice blocking any new write requests.
Bottleneck to flusher parallelism.

• パラレルダブルライトバッファ (Parallel doublewrite buffer)

• バッチ・フラッシュ・モードごとに、各バッファー・プール・インスタンスご
との専⽤用の⼆二重書きバッファー

• Private doublewrite buffers for each buffer pool instance, for each batch
flushing mode
14
Percona XtraDB - I/O bound, concurrent
workloads
• マルチスレッドLRUフラッシャー (Multi-threaded LRU flusher)

• 各バッファプールインスタンスには、LRUフラッシュ/エビク
ションを実⾏行行してそのバッファプールインスタンスの空きリスト
を補充する専⽤用のLRUマネージャスレッドがあります

• each buffer pool instance has its own dedicated LRU manager
thread performing LRU flushes/evictions to refill the free list of
that buffer pool instance

• バッファプールフリーリストの優先度リフィル (Priority refill of the
buffer pool free list)
15
Percona XtraDB - changed page tracking
• REDOログに従って変更更が書き込まれたページを追跡します。

• Tracks the pages that have changes written to them according to the redo log

• Percona XtraBackupによる増分バックアップのスピードアップ - データファイル全体をス
キャンする必要がなくなり、シーケンス番号を使⽤用して必要なビットマップファイルの存在
をチェックできます

• Speed up incremental backups made with Percona XtraBackup - no need to scan whole
data files any longer, sequence number can be used to check presence of required
bitmap files

• 変更更されたページトラッキングは、チェックポイント間のログレコードを読み込んで解析す
る新しいXtraDBワーカースレッドによって⾏行行われます。

• Changed page tracking is done by a new XtraDB worker thread that reads and parses
log records between checkpoints.
16
Backup locks
• Lightweight alternative to FLUSH TABLES WITH READ LOCK
• ⾮非トランザクションテーブルとすべてのテーブルのDDLステー
トメントへの更更新をブロックする新しいMDLロックタイプ
• New MDL lock type to block updates to non-transactional
tables and DDL statements for all tables

• LOCK TABLES FOR BACKUP, LOCK BINLOG FOR
BACKUP, UNLOCK BINLOG
17
START TRANSACTION WITH CONSISTENT
SNAPSHOT
• バイナリログの位置をInnoDBのトランザクションスナップショットと⼀一致させる

• Make binary log positions consistent with InnoDB transaction snapshots

• binlog_snapshot_position, binlog_snapshot_file - binlog position
corresponding to the state of the database consistent snapshot, irrespective of other
transactions committed since snapshot taken (取得されたスナップショット以降にコ
ミットされた他のトランザクションとは無関係に、データベース⼀一貫性のあるスナッ
プショットの状態に対応する位置)

• FLUSH TABLES WITH READ LOCKを使⽤用せずに正しい位置で論理理バックアップを取得する

• Obtain logical backups with correct positions without using FLUSH TABLES WITH
READ LOCK
• … FROM SESSION <sessionID>
• mysqldump —single-transaction —master-data
18
NUMA Support
• MySQLの「スワップの狂気」問題を避ける

• Avoids the MySQL “swap insanity” problem

• バッファプールメモリがノードのサイズよりも⼤大きい場合、システムは他のノード
に使⽤用可能なメモリがあっても割り当てられたメモリをスワップします。 NUMA
インタリーブでこれを解決

• Buffer pool memory bigger than size of node, system would swap allocated
memory even if there was available memory on other node. NUMA interleaving
solves this

• 通常の使⽤用/ベンチマークのための⼀一貫した予測可能な動作の確⽴立に役⽴立ちます

• Useful for establishing consistent and predictable behaviour for normal usage/
benchmarking
19
Threadpool
• thread-handling = pool-of-threads
• 優先スケジューリング (Priority Scheduling)

• 優先順位が⾼高いか低いかを判断するために与えられたチケット

• tickets given to determine if it goes into a high priority or low
priority mode

• オーバーサブスクリプション制限に達することがないようにしま
す。

• Ensures that you never reach the oversubscribe limit
20
Per query variable statement
• SET STATEMENT
max_execution_time=1000 FOR SELECT
name FROM name ORDER BY name;
• Google Summer of Code 2009プロジェクトとし
て始まったPercona Server 5.6に登場しました!

• Arrived in Percona Server 5.6, originated as
Google Summer of Code 2009 project!
21
Using HAProxy?
• PROXY protocol

• 中間プロキシサーバーがサーバーと最終的なクライアント間の
プロキシプロトコルを話すことを許可し、通常はプロキシサー
バーアドレスが代わりに表示されるサーバーに送信元クライア
ントアドレスを提供します。

• Allows an intermediate proxying server speaking the proxy
protocol between the server and the ultimate client to
provide the source client address to the server, which
normally would only see the proxying server address instead.
22
Automated manageability enhancements
• enforce_storage_engine
• Utility user 

• 管理理タスクを実⾏行行するシステムアクセス権を持
ち、ユーザースキーマへのアクセスが制限されて
いるユーザー

• user who has system access to do administrative
tasks but limited access to user schema
23
Other features
• Extended SHOW GRANTS
• ユーザー統計

• 拡張された低速クエリログ - マイクロ秒
の時間、追加の統計情報(pt-query-
digest⽤用)、実⾏行行時の有効/無効、スレー
ブSQLスレッドのログ、ログのローテー
ション/有効期限

• 応答時間配布プラグイン - 多数の⼩小さな
実⾏行行クエリ?

• アイドル状態のXtraDBトランザクション
を強制終了了する

• 修正中に破損したXtraDBテーブルを無効
にする(サーバーはハングし続ける)

• SELECT INTO OUTFILE / DUMPFILEは
UNIXソケット、名前付きパイプをサポー
トしています

• max_binlog_files

• 改善されたMEMORYおよびCSVスト
レージエンジン

• SSLオプション付きのmysqlbinlog

• セッションごとのサーバーID
24
Other features
• Extended SHOW GRANTS
• User statistics

• Extended slow query log -
microsecond time, additional
statistics (for pt-query-digest),
enable/disable at runtime, logging for
slave SQL thread, log rotation/
expiration

• Response time distribution plugin -
large number of small running
queries?

• Kill idle XtraDB transactions

• Disable corrupted XtraDB tables
while getting fixed (server continues
humming along)

• SELECT INTO OUTFILE/DUMPFILE
supports UNIX sockets, named pipes

• max_binlog_files
• Improved MEMORY and CSV storage
engines

• mysqlbinlog with SSL options

• Per session server IDs
25
Other Enterprise features made open
• PAM認証プラグイン (PAM Authentication plugin)

• auth_pam, using dialog.so

• auth_pam_compat, uses mysql_clear_password to be fully MySQL compliant

• 監査プラグイン (Audit plugin)

• 複数のフォーマット(互換性を維持する - mysqlauditgrep)、ストリームをsyslog、ユーザまたはSQL
コマンドタイプ(またはデータベース)でフィルタする

• Multiple formats (but remain compatible - mysqlauditgrep), stream to syslog, filter by user or SQL
command type (or database)

• 戦略略は⾮非同期(ログメモリバッファ、バッファがいっぱいになるとメッセージをドロップしない)、パ
フォーマンス、セミシンク(ログにファイル、すべてのイベントをフラッシュして同期させない)、同
期

• Performance matters - so strategy can be asynchronous (log memory buffer, do not drop messages
if buffer is full), performance, semi-sync (log to file, do not flush and sync every event) or
synchronous
26
Unafraid to remove features
• Scalability metrics plugin deprecated

• Reflex adaptive checkpoint

• Prefer using the upstream
implementation rather than Percona’s
own engineering work

• Better for maintenance
27
Replaced by upstream fix!
28
Some features start life in 5.6 first…
• TLS v1.1/v1.2, disabling v1.0

• HandlerSocket - not going to 5.7

• Online GTID deployment using the “step
mode” that Facebook created - not
needed in 5.7
29
Compressed columns
• データ型修飾⼦子 - 書き込み時に圧縮され、読み出し時に圧縮解除され
る

• Data type modifier - compressed on writing, decompressed on read

• XtraDB, and column limitations: BLOB/TEXT/VARCHAR/VARBINARY

• 圧縮辞書をあらかじめ定義する

• Pre-define a compression dictionary

• https://engineering.pinterest.com/blog/evolving-mysql-compression-
part-1 

• Thank you Alibaba / Weixiang Zhai
30
Percona TokuDB
• Percona TokuBackup - データベースをロックせず、ファイルを書き
込み、バックアップディレクトリへの書き込みを傍受するシステム
コールを傍受する

• Percona TokuBackup - no locking of database, intercepts syscalls
that write files and duplicates the writes to backup directory

• “これは、3〜5年年以内にMyRocksが、想像を絶するすべての作業負
荷の機能とパフォーマンスにおいて、TokuDBより優れている可能性
があることを意味します。”

• https://www.percona.com/blog/2016/11/01/future-tokudb-percona/
31
Percona XtraDB Cluster with ProxySQL
• 統合クラスタ対応ロードバランサ

• Integrated cluster aware load balancer

• PERFORMANCE_SCHEMAによる計測

• Instrumentation with PERFORMANCE_SCHEMA

• 暗号化されたままのデータに対する完全なサポート(InnoDB Tablespace Encryption)

• Full support for data at rest encryption (InnoDB Tablespace Encryption)

• データはデフォルトで安全です "厳格なモード" - 機能はアップストリームで正しく機能
しないとみなされ、無効になります

• Data is safe by default “strict mode” - features deemed to work incorrectly by
upstream, disabled

• PMMとの完全統合 (Full integration with PMM)
32
MyRocks
• Facebookからの空間と書き込み最適化データベース
(チームリーダー:Yoshinori Matsunobu)

• Space and write-optimized database from Facebook
(team lead: Yoshinori Matsunobu)

• https://code.facebook.com/posts/190251048047090/
myrocks-a-space-and-write-optimized-mysql-
database/

• TRY IT NOW!
33
Percona Monitoring & Management
• Grafana、Consul、Prometheus、Orchestratorなどのオープ
ンソースのソフトウェアツールの上に構築されています

• Built on top of the best of breed open source software
tools like Grafana, Consul, Prometheus, and Orchestrator

• Supports MySQL and MongoDB

• 傾向分析およびクエリ分析

• Trending and Query Analysis

• http://pmmdemo.percona.com/
34
Percona Server for MongoDB
• ペルコナメモリエンジン (Percona Memory Engine)

• MongoRocks

• WiredTiger&MongoRocksのホットバックアップ

• Hot backup for WiredTiger & MongoRocks

• エンタープライズ機能が公開されました:監査ログ、SASL認証

• Enterprise features made open: Audit Logging, SASL
Authentication

• その他の新機能:プロファイリングレート制限

• Other new features: profiling rate limiting
35
Conclusions
• Percona Toolkit(2011年年以降は便便利利!)、Percona
XtraBackup(事実上のホットバックアップソリューション)

• Didn’t cover Percona Toolkit (useful since 2011!), Percona
XtraBackup (de-facto hot backup solution)

• Perconaはすべてのソフトウェアをサポートしており、停⽌止
していません(EOL情報は事前に公開されています)

• Percona is supporting all software and isn’t stopping (EOL
information is published well in advance)
36
Percona is Hiring!
• http://www.percona.com/careers/

• Remote DBAs, C/C++ developers, Go
developers, etc.
37
Percona Live Europe Dublin
• https://www.percona.com/live/e17/ 

• September 25-27 2017, Dublin, Ireland

• Want a 15% discount? Use promotional
code: COLIN15
38
Thank you!
Colin Charles
colin.charles@percona.com / byte@bytebot.net
http://bytebot.net/blog | @bytebot on twitter | bytebot on Line
slides: slideshare.net/bytebot
39

More Related Content

PPTX
Yahoo! JAPANのOracle構成-2017年版
PPTX
[db tech showcase Tokyo 2017] A15: レプリケーションを使用したデータ分析基盤構築のキモ(事例)by 株式会社インサイトテ...
PDF
Yahoo! JAPANのプライベートRDBクラウドとマルチライター型 MySQL #dbts2017 #dbtsOSS
PDF
[db tech showcase Tokyo 2017] D21: ついに Red Hat Enterprise Linuxで SQL Serverが使...
PDF
[db tech showcase Tokyo 2014] C34:[楽天] 詳説 楽天のデータベースアーキテクチャ史 -シングルノードから仮想化フラッシ...
PDF
MySQL InnoDB Clusterによる高可用性構成(DB Tech Showcase 2017)
PDF
事例から見るNoSQLの使い方 - db tech showcase Tokyo 2015 2015/06/11
PDF
[db tech showcase Tokyo 2015] B12:カラムストアデータベースの技術と活用法 by 日本電気株式会社 田村稔
Yahoo! JAPANのOracle構成-2017年版
[db tech showcase Tokyo 2017] A15: レプリケーションを使用したデータ分析基盤構築のキモ(事例)by 株式会社インサイトテ...
Yahoo! JAPANのプライベートRDBクラウドとマルチライター型 MySQL #dbts2017 #dbtsOSS
[db tech showcase Tokyo 2017] D21: ついに Red Hat Enterprise Linuxで SQL Serverが使...
[db tech showcase Tokyo 2014] C34:[楽天] 詳説 楽天のデータベースアーキテクチャ史 -シングルノードから仮想化フラッシ...
MySQL InnoDB Clusterによる高可用性構成(DB Tech Showcase 2017)
事例から見るNoSQLの使い方 - db tech showcase Tokyo 2015 2015/06/11
[db tech showcase Tokyo 2015] B12:カラムストアデータベースの技術と活用法 by 日本電気株式会社 田村稔

What's hot (20)

PDF
MySQL Cluster 新機能解説 7.5 and beyond
PDF
[db tech showcase Tokyo 2015] C17:MySQL Cluster ユーザー事例紹介~JR東日本情報システム様における導入事例...
PDF
[db tech showcase Tokyo 2015] A33:Amazon DynamoDB Deep Dive by アマゾン データ サービス ...
PPTX
[db tech showcase Tokyo 2015] E26 Couchbaseの最新情報/JBoss Data Virtualizationで仮想...
PDF
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
PDF
[db tech showcase Tokyo 2015] B34:データの仮想化を具体化するIBMのロジカルデータウェアハウス by 日本アイ・ビー・エ...
PDF
[db tech showcase Tokyo 2015] A33:Amazon Aurora Deep Dive by アマゾン データ サービス ジャ...
PDF
[db tech showcase Tokyo 2017] E34: データベース・サービスを好きなところで動かそう Db2 Warehouse by 日...
PDF
[db tech showcase Tokyo 2017] D35: 何を基準に選定すべきなのか!? ~ビッグデータ×IoT×AI時代のデータベースのアー...
PDF
Cassandra Summit Tokyo 2015 - intra-mart
PDF
Db tech showcase2015 how to replicate between clusters
PDF
Couchbase introduction-20150611
PDF
PHP開発者のためのNoSQL入門
PDF
[db tech showcase Tokyo 2017] B14: 4年連続No.1リーダー評価のストレージでDBクローンするとどんな感じ?瞬時のクロー...
PDF
[data analytics showcase] B16: Live Demo! データ分析基盤を支えるデータレプリケーション技術とデータワークロード分...
PDF
リペア時間短縮にむけた取り組み@Yahoo! JAPAN #casstudy
PDF
[db tech showcase Tokyo 2017] E35: 12台でやってみた!DWHソフトウェアアプライアンス Db2 Warehouse ~...
PDF
Cassandraとh baseの比較して入門するno sql
PDF
Dbts2015 tokyo vector_in_hadoop_vortex
PDF
[db tech showcase Tokyo 2017] E26: 窓は開かれた! SQL Server on Linux で拡がる可能性 by 日本マ...
MySQL Cluster 新機能解説 7.5 and beyond
[db tech showcase Tokyo 2015] C17:MySQL Cluster ユーザー事例紹介~JR東日本情報システム様における導入事例...
[db tech showcase Tokyo 2015] A33:Amazon DynamoDB Deep Dive by アマゾン データ サービス ...
[db tech showcase Tokyo 2015] E26 Couchbaseの最新情報/JBoss Data Virtualizationで仮想...
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
[db tech showcase Tokyo 2015] B34:データの仮想化を具体化するIBMのロジカルデータウェアハウス by 日本アイ・ビー・エ...
[db tech showcase Tokyo 2015] A33:Amazon Aurora Deep Dive by アマゾン データ サービス ジャ...
[db tech showcase Tokyo 2017] E34: データベース・サービスを好きなところで動かそう Db2 Warehouse by 日...
[db tech showcase Tokyo 2017] D35: 何を基準に選定すべきなのか!? ~ビッグデータ×IoT×AI時代のデータベースのアー...
Cassandra Summit Tokyo 2015 - intra-mart
Db tech showcase2015 how to replicate between clusters
Couchbase introduction-20150611
PHP開発者のためのNoSQL入門
[db tech showcase Tokyo 2017] B14: 4年連続No.1リーダー評価のストレージでDBクローンするとどんな感じ?瞬時のクロー...
[data analytics showcase] B16: Live Demo! データ分析基盤を支えるデータレプリケーション技術とデータワークロード分...
リペア時間短縮にむけた取り組み@Yahoo! JAPAN #casstudy
[db tech showcase Tokyo 2017] E35: 12台でやってみた!DWHソフトウェアアプライアンス Db2 Warehouse ~...
Cassandraとh baseの比較して入門するno sql
Dbts2015 tokyo vector_in_hadoop_vortex
[db tech showcase Tokyo 2017] E26: 窓は開かれた! SQL Server on Linux で拡がる可能性 by 日本マ...
Ad

Similar to Percona ServerをMySQL 5.6と5.7用に作るエンジニアリング(そしてMongoDBのヒント) (20)

PDF
ついにリリース!! MySQL 8.0 最新情報
PPTX
Rakuten New MySQL Backup System With Xtrabackup
PDF
MySQL最新情報
PDF
Enter the-dolphine
PPTX
MySQL Technology Cafe #14 MySQL Shellを使ってもっと楽をしようの会
PPTX
[OSC 2017 Tokyo/Fall] OSSコンソーシアム DB部会 MySQL 8.0
PDF
MySQL 開発最新動向
PDF
MySQLのNoSQL機能 - MySQL JSON & HTTP Plugin for MySQL
PDF
MySQL 5.7の次のMySQLは
PDF
MySQL 5.7 & 最新開発状況 @ オープンソースカンファレンス20
PDF
20150131 ChugokuDB-Shimane-MySQL
PDF
MySQL最新情報  ※2016年12月
PDF
20150920 中国地方db勉強会
PDF
LINEのMySQL運用について
PDF
DTraceによるMySQL解析ことはじめ
PDF
[D37]MySQLの真のイノベーションはこれだ!MySQL 5.7と「実験室」 by Ryusuke Kajiyama
PDF
第九回中国地方DB勉強会 in 米子 MySQL 5.7+
PDF
MySQL 5.5 Update #denatech
PDF
db tech showcase2016 - MySQLドキュメントストア
PDF
20130203 OSS-DB Exam Silver 技術解説無料セミナー
ついにリリース!! MySQL 8.0 最新情報
Rakuten New MySQL Backup System With Xtrabackup
MySQL最新情報
Enter the-dolphine
MySQL Technology Cafe #14 MySQL Shellを使ってもっと楽をしようの会
[OSC 2017 Tokyo/Fall] OSSコンソーシアム DB部会 MySQL 8.0
MySQL 開発最新動向
MySQLのNoSQL機能 - MySQL JSON & HTTP Plugin for MySQL
MySQL 5.7の次のMySQLは
MySQL 5.7 & 最新開発状況 @ オープンソースカンファレンス20
20150131 ChugokuDB-Shimane-MySQL
MySQL最新情報  ※2016年12月
20150920 中国地方db勉強会
LINEのMySQL運用について
DTraceによるMySQL解析ことはじめ
[D37]MySQLの真のイノベーションはこれだ!MySQL 5.7と「実験室」 by Ryusuke Kajiyama
第九回中国地方DB勉強会 in 米子 MySQL 5.7+
MySQL 5.5 Update #denatech
db tech showcase2016 - MySQLドキュメントストア
20130203 OSS-DB Exam Silver 技術解説無料セミナー
Ad

More from Colin Charles (20)

PDF
Differences between MariaDB 10.3 & MySQL 8.0
PDF
What is MariaDB Server 10.3?
PDF
Databases in the hosted cloud
PDF
MySQL features missing in MariaDB Server
PDF
The MySQL ecosystem - understanding it, not running away from it!
PDF
Databases in the Hosted Cloud
PDF
Best practices for MySQL High Availability Tutorial
PDF
Capacity planning for your data stores
PDF
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
PDF
Lessons from {distributed,remote,virtual} communities and companies
PDF
Forking Successfully - or is a branch better?
PDF
MariaDB Server Compatibility with MySQL
PDF
Securing your MySQL / MariaDB Server data
PDF
The MySQL Server Ecosystem in 2016
PDF
The Complete MariaDB Server tutorial
PDF
Best practices for MySQL/MariaDB Server/Percona Server High Availability
PDF
Lessons from database failures
PDF
Lessons from database failures
PDF
Lessons from database failures
PDF
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
Differences between MariaDB 10.3 & MySQL 8.0
What is MariaDB Server 10.3?
Databases in the hosted cloud
MySQL features missing in MariaDB Server
The MySQL ecosystem - understanding it, not running away from it!
Databases in the Hosted Cloud
Best practices for MySQL High Availability Tutorial
Capacity planning for your data stores
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
Lessons from {distributed,remote,virtual} communities and companies
Forking Successfully - or is a branch better?
MariaDB Server Compatibility with MySQL
Securing your MySQL / MariaDB Server data
The MySQL Server Ecosystem in 2016
The Complete MariaDB Server tutorial
Best practices for MySQL/MariaDB Server/Percona Server High Availability
Lessons from database failures
Lessons from database failures
Lessons from database failures
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup

Percona ServerをMySQL 5.6と5.7用に作るエンジニアリング(そしてMongoDBのヒント)

  • 1. Percona ServerをMySQL 5.6と5.7⽤用に作るエンジニアリング(そして MongoDBのヒント) Engineering that goes into making Percona Server for MySQL 5.6 & 5.7 different (and a hint of MongoDB) Colin Charles, Chief Evangelist, Percona Inc. colin.charles@percona.com / byte@bytebot.net http://bytebot.net/blog/ | @bytebot on Twitter db tech showcase Tokyo, Japan 6 September 2017 1
  • 2. whoami • Chief Evangelist, Percona Inc • Focusing on the MySQL ecosystem (MySQL, Percona Server, MariaDB Server), as well as the MongoDB ecosystem (Percona Server for MongoDB) + 100% open source tools from Percona like Percona Monitoring & Management, Percona xtrabackup, Percona Toolkit, etc. • Founding team of MariaDB Server (2009-2016), previously at Monty Program Ab, merged with SkySQL Ab, now MariaDB Corporation • Formerly MySQL AB (exit: Sun Microsystems) • Past lives include Fedora Project (FESCO), OpenOffice.org • MySQL Community Contributor of the Year Award winner 2014 2
  • 3. Agenda • Percona’s Aims • Developing a branch of MySQL • Adding features that make a difference • Custom development • Tools • Sustainable engineering going forward 3
  • 5. Percona Software Principles すべてのPerconaソフトウェアは100%無料料でオープンソースです All Percona Software is 100% Free and Open Source あなたが⽀支払う必要がある "エンタープライズ"バージョンはありません No Restricted “Enterprise” version オープンコアなし No Open Core いいえソフトウェアライセンスゲーム No Software Licensing Games 5
  • 6. 6 Widely deployed Open Source Software
  • 7. Aims • ソフトウェアフォークではない • Branch, not a fork • オープンソースソフトウェアの独⾃自の部分に代わるものを提供する • Provide alternatives to proprietary parts of open source software • 強⼒力力な運⽤用フォーカス:互換性、アプリケーションのスケーラビリ ティ、⾼高可⽤用性、セキュリティ、可観測性 • Strong operations focus: compatibility, application scalability, high availability, security, observability 7
  • 8. History (or how it all began) • Percona Server: 8 years old — November 2008 (Percona SQL, Percona highperf builds) • November 2008: Percona Server (patchset ~July) 8
  • 9. Timeline • December 2010: MySQL 5.5 GA • April 2011: Percona Server for MySQL GA • February 2013: MySQL 5.6 GA • October 2013: Percona Server for MySQL GA • October 2015: MySQL 5.7 GA • February 2016: Percona Server for MySQL GA 9
  • 10. Straight from the docs 10
  • 11. Software engineering • ⼈人々が⽂文書内でコメントできる完全な仕様の設計⽂文書にリンクするリストに詳細な説明を書く • Write a detailed description to a list linking to a full specification design document where people can comment within the document • 品質保証への公式ハンドオーバー(QA) • Official handover to quality assurance (QA) • In addition to pquery tests, specify what requirements there are • 設計⽂文書とリスト上で⾏行行われたすべての議論のおかげで⽂文書化が容易易になりました • Documentation is made easier thanks to design document and all the discussions that took place on list • もちろん、ブログ! • Blog, of course! 11
  • 12. Development • Jenkins • Bazaar (Launchpad) and Git (Github) • Jira (MyRocks) • パブリックリストは、開発ではなくエンドユー ザーサポートのための • Public lists are still more for end user support rather than development 12
  • 13. Percona XtraDB - buffer pool, I/O scalability • SHOW ENGINE INNODB STATUS extended output • バッファプールを保護するグローバルミューテックスは、競合を減らすた めに複数のmutexに分割されています。ワーキングセットがメモリに収まら ない場合 • Global mutex protecting the buffer pool has been split into several mutexes to decrease contention - good when working set doesn’t fit in memory • ログブロックサイズを変更更するには、innodb_flush_method = ALL_O_DIRECT • Change the log block size, innodb_flush_method=ALL_O_DIRECT 13
  • 14. Percona XtraDB - I/O bound, concurrent workloads • レガシーダブルライトバッファは、すべてのページ書き込み要求を1つのバッ ファに集めます。書き込みが完了了すると、新しい書き込み要求をブロックして2 回ディスクに書き出します。 ボトルネックで洗練された並列列性。 • Legacy doublewrite buffer collects all page write requests into a single buffer, when filled, writes it out to disk twice blocking any new write requests. Bottleneck to flusher parallelism. • パラレルダブルライトバッファ (Parallel doublewrite buffer) • バッチ・フラッシュ・モードごとに、各バッファー・プール・インスタンスご との専⽤用の⼆二重書きバッファー • Private doublewrite buffers for each buffer pool instance, for each batch flushing mode 14
  • 15. Percona XtraDB - I/O bound, concurrent workloads • マルチスレッドLRUフラッシャー (Multi-threaded LRU flusher) • 各バッファプールインスタンスには、LRUフラッシュ/エビク ションを実⾏行行してそのバッファプールインスタンスの空きリスト を補充する専⽤用のLRUマネージャスレッドがあります • each buffer pool instance has its own dedicated LRU manager thread performing LRU flushes/evictions to refill the free list of that buffer pool instance • バッファプールフリーリストの優先度リフィル (Priority refill of the buffer pool free list) 15
  • 16. Percona XtraDB - changed page tracking • REDOログに従って変更更が書き込まれたページを追跡します。 • Tracks the pages that have changes written to them according to the redo log • Percona XtraBackupによる増分バックアップのスピードアップ - データファイル全体をス キャンする必要がなくなり、シーケンス番号を使⽤用して必要なビットマップファイルの存在 をチェックできます • Speed up incremental backups made with Percona XtraBackup - no need to scan whole data files any longer, sequence number can be used to check presence of required bitmap files • 変更更されたページトラッキングは、チェックポイント間のログレコードを読み込んで解析す る新しいXtraDBワーカースレッドによって⾏行行われます。 • Changed page tracking is done by a new XtraDB worker thread that reads and parses log records between checkpoints. 16
  • 17. Backup locks • Lightweight alternative to FLUSH TABLES WITH READ LOCK • ⾮非トランザクションテーブルとすべてのテーブルのDDLステー トメントへの更更新をブロックする新しいMDLロックタイプ • New MDL lock type to block updates to non-transactional tables and DDL statements for all tables • LOCK TABLES FOR BACKUP, LOCK BINLOG FOR BACKUP, UNLOCK BINLOG 17
  • 18. START TRANSACTION WITH CONSISTENT SNAPSHOT • バイナリログの位置をInnoDBのトランザクションスナップショットと⼀一致させる • Make binary log positions consistent with InnoDB transaction snapshots • binlog_snapshot_position, binlog_snapshot_file - binlog position corresponding to the state of the database consistent snapshot, irrespective of other transactions committed since snapshot taken (取得されたスナップショット以降にコ ミットされた他のトランザクションとは無関係に、データベース⼀一貫性のあるスナッ プショットの状態に対応する位置) • FLUSH TABLES WITH READ LOCKを使⽤用せずに正しい位置で論理理バックアップを取得する • Obtain logical backups with correct positions without using FLUSH TABLES WITH READ LOCK • … FROM SESSION <sessionID> • mysqldump —single-transaction —master-data 18
  • 19. NUMA Support • MySQLの「スワップの狂気」問題を避ける • Avoids the MySQL “swap insanity” problem • バッファプールメモリがノードのサイズよりも⼤大きい場合、システムは他のノード に使⽤用可能なメモリがあっても割り当てられたメモリをスワップします。 NUMA インタリーブでこれを解決 • Buffer pool memory bigger than size of node, system would swap allocated memory even if there was available memory on other node. NUMA interleaving solves this • 通常の使⽤用/ベンチマークのための⼀一貫した予測可能な動作の確⽴立に役⽴立ちます • Useful for establishing consistent and predictable behaviour for normal usage/ benchmarking 19
  • 20. Threadpool • thread-handling = pool-of-threads • 優先スケジューリング (Priority Scheduling) • 優先順位が⾼高いか低いかを判断するために与えられたチケット • tickets given to determine if it goes into a high priority or low priority mode • オーバーサブスクリプション制限に達することがないようにしま す。 • Ensures that you never reach the oversubscribe limit 20
  • 21. Per query variable statement • SET STATEMENT max_execution_time=1000 FOR SELECT name FROM name ORDER BY name; • Google Summer of Code 2009プロジェクトとし て始まったPercona Server 5.6に登場しました! • Arrived in Percona Server 5.6, originated as Google Summer of Code 2009 project! 21
  • 22. Using HAProxy? • PROXY protocol • 中間プロキシサーバーがサーバーと最終的なクライアント間の プロキシプロトコルを話すことを許可し、通常はプロキシサー バーアドレスが代わりに表示されるサーバーに送信元クライア ントアドレスを提供します。 • Allows an intermediate proxying server speaking the proxy protocol between the server and the ultimate client to provide the source client address to the server, which normally would only see the proxying server address instead. 22
  • 23. Automated manageability enhancements • enforce_storage_engine • Utility user • 管理理タスクを実⾏行行するシステムアクセス権を持 ち、ユーザースキーマへのアクセスが制限されて いるユーザー • user who has system access to do administrative tasks but limited access to user schema 23
  • 24. Other features • Extended SHOW GRANTS • ユーザー統計 • 拡張された低速クエリログ - マイクロ秒 の時間、追加の統計情報(pt-query- digest⽤用)、実⾏行行時の有効/無効、スレー ブSQLスレッドのログ、ログのローテー ション/有効期限 • 応答時間配布プラグイン - 多数の⼩小さな 実⾏行行クエリ? • アイドル状態のXtraDBトランザクション を強制終了了する • 修正中に破損したXtraDBテーブルを無効 にする(サーバーはハングし続ける) • SELECT INTO OUTFILE / DUMPFILEは UNIXソケット、名前付きパイプをサポー トしています • max_binlog_files • 改善されたMEMORYおよびCSVスト レージエンジン • SSLオプション付きのmysqlbinlog • セッションごとのサーバーID 24
  • 25. Other features • Extended SHOW GRANTS • User statistics • Extended slow query log - microsecond time, additional statistics (for pt-query-digest), enable/disable at runtime, logging for slave SQL thread, log rotation/ expiration • Response time distribution plugin - large number of small running queries? • Kill idle XtraDB transactions • Disable corrupted XtraDB tables while getting fixed (server continues humming along) • SELECT INTO OUTFILE/DUMPFILE supports UNIX sockets, named pipes • max_binlog_files • Improved MEMORY and CSV storage engines • mysqlbinlog with SSL options • Per session server IDs 25
  • 26. Other Enterprise features made open • PAM認証プラグイン (PAM Authentication plugin) • auth_pam, using dialog.so • auth_pam_compat, uses mysql_clear_password to be fully MySQL compliant • 監査プラグイン (Audit plugin) • 複数のフォーマット(互換性を維持する - mysqlauditgrep)、ストリームをsyslog、ユーザまたはSQL コマンドタイプ(またはデータベース)でフィルタする • Multiple formats (but remain compatible - mysqlauditgrep), stream to syslog, filter by user or SQL command type (or database) • 戦略略は⾮非同期(ログメモリバッファ、バッファがいっぱいになるとメッセージをドロップしない)、パ フォーマンス、セミシンク(ログにファイル、すべてのイベントをフラッシュして同期させない)、同 期 • Performance matters - so strategy can be asynchronous (log memory buffer, do not drop messages if buffer is full), performance, semi-sync (log to file, do not flush and sync every event) or synchronous 26
  • 27. Unafraid to remove features • Scalability metrics plugin deprecated • Reflex adaptive checkpoint • Prefer using the upstream implementation rather than Percona’s own engineering work • Better for maintenance 27
  • 29. Some features start life in 5.6 first… • TLS v1.1/v1.2, disabling v1.0 • HandlerSocket - not going to 5.7 • Online GTID deployment using the “step mode” that Facebook created - not needed in 5.7 29
  • 30. Compressed columns • データ型修飾⼦子 - 書き込み時に圧縮され、読み出し時に圧縮解除され る • Data type modifier - compressed on writing, decompressed on read • XtraDB, and column limitations: BLOB/TEXT/VARCHAR/VARBINARY • 圧縮辞書をあらかじめ定義する • Pre-define a compression dictionary • https://engineering.pinterest.com/blog/evolving-mysql-compression- part-1 • Thank you Alibaba / Weixiang Zhai 30
  • 31. Percona TokuDB • Percona TokuBackup - データベースをロックせず、ファイルを書き 込み、バックアップディレクトリへの書き込みを傍受するシステム コールを傍受する • Percona TokuBackup - no locking of database, intercepts syscalls that write files and duplicates the writes to backup directory • “これは、3〜5年年以内にMyRocksが、想像を絶するすべての作業負 荷の機能とパフォーマンスにおいて、TokuDBより優れている可能性 があることを意味します。” • https://www.percona.com/blog/2016/11/01/future-tokudb-percona/ 31
  • 32. Percona XtraDB Cluster with ProxySQL • 統合クラスタ対応ロードバランサ • Integrated cluster aware load balancer • PERFORMANCE_SCHEMAによる計測 • Instrumentation with PERFORMANCE_SCHEMA • 暗号化されたままのデータに対する完全なサポート(InnoDB Tablespace Encryption) • Full support for data at rest encryption (InnoDB Tablespace Encryption) • データはデフォルトで安全です "厳格なモード" - 機能はアップストリームで正しく機能 しないとみなされ、無効になります • Data is safe by default “strict mode” - features deemed to work incorrectly by upstream, disabled • PMMとの完全統合 (Full integration with PMM) 32
  • 33. MyRocks • Facebookからの空間と書き込み最適化データベース (チームリーダー:Yoshinori Matsunobu) • Space and write-optimized database from Facebook (team lead: Yoshinori Matsunobu) • https://code.facebook.com/posts/190251048047090/ myrocks-a-space-and-write-optimized-mysql- database/ • TRY IT NOW! 33
  • 34. Percona Monitoring & Management • Grafana、Consul、Prometheus、Orchestratorなどのオープ ンソースのソフトウェアツールの上に構築されています • Built on top of the best of breed open source software tools like Grafana, Consul, Prometheus, and Orchestrator • Supports MySQL and MongoDB • 傾向分析およびクエリ分析 • Trending and Query Analysis • http://pmmdemo.percona.com/ 34
  • 35. Percona Server for MongoDB • ペルコナメモリエンジン (Percona Memory Engine) • MongoRocks • WiredTiger&MongoRocksのホットバックアップ • Hot backup for WiredTiger & MongoRocks • エンタープライズ機能が公開されました:監査ログ、SASL認証 • Enterprise features made open: Audit Logging, SASL Authentication • その他の新機能:プロファイリングレート制限 • Other new features: profiling rate limiting 35
  • 36. Conclusions • Percona Toolkit(2011年年以降は便便利利!)、Percona XtraBackup(事実上のホットバックアップソリューション) • Didn’t cover Percona Toolkit (useful since 2011!), Percona XtraBackup (de-facto hot backup solution) • Perconaはすべてのソフトウェアをサポートしており、停⽌止 していません(EOL情報は事前に公開されています) • Percona is supporting all software and isn’t stopping (EOL information is published well in advance) 36
  • 37. Percona is Hiring! • http://www.percona.com/careers/ • Remote DBAs, C/C++ developers, Go developers, etc. 37
  • 38. Percona Live Europe Dublin • https://www.percona.com/live/e17/ • September 25-27 2017, Dublin, Ireland • Want a 15% discount? Use promotional code: COLIN15 38
  • 39. Thank you! Colin Charles colin.charles@percona.com / byte@bytebot.net http://bytebot.net/blog | @bytebot on twitter | bytebot on Line slides: slideshare.net/bytebot 39