1 Copyright © 2012, Oracle and/or its affiliates. All rights ... Copyright © 2012, Oracle and/or...
Transcript of 1 Copyright © 2012, Oracle and/or its affiliates. All rights ... Copyright © 2012, Oracle and/or...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 1
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 2
MySQL パフォーマンス機能 改善点紹介
日本オラクル株式会社
山崎 由章 / MySQL Senior Sales Consultant,
Asia Pacific and Japan
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 3
以下の事項は、弊社の一般的な製品の方向性に関する概要を説明するものです。また、情報提供を唯一の目的とするものであり、いかなる契約にも組み込むことはできません。以下の事項は、マテリアルやコード、機能を提供することをコミットメント(確約)するものではないため、購買決定を行う際の判断材料になさらないで下さい。オラクル製品に関して記載されている機能の開発、リリースおよび時期については、弊社の裁量により決定されます。
OracleとJavaは、Oracle Corporation 及びその子会社、関連会社の米国及びその他の国における登録商標です。文中の社名、商品名等は各社の商標または登録商標である場合があります。
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 4
アジェンダ
MySQL Cluster CGE 最新ベンチマーク結果
InnoDB と MyISAMの比較
MySQL 5.6での性能改善点
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 5
MySQL Cluster 7.2 : 2月15日GA版リリース
読み取り/ 書き込み処理のスケーラビリティ
99.999%の可用性
非常に低いレイテンシ
SQLおよびNoSQLアクセスおよびスキーマの柔軟性
Web
• 大規模なOLTP • eコマース • ユーザー・プロファイル管理 • セッション管理およびキャッシング • コンテンツ管理 • オンライン・ゲーム
通信
• 加入者データベース(HLR / HSS) • サービス・デリバリー・プラット
フォーム • VAS: VoIP、IPTV および VoD • モバイル・コンテンツ配信 • モバイル決済 • LTEアクセス
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 6
MySQL Cluster アーキテクチャ
データ・ノード
ノード・グループ1
F1
F3
F3
F1
ノード
1
ノード
2
ノード・グールプ 2
F2
F4
F4
F2
ノード
3
ノード
4
アプリケーション・ノード
クラスタ管理 クラスタ管理
REST
JPA
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 7
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 8
4.3
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 9
4.3
/ 1 Billion Updates per Minute
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 10
MySQL Cluster ベンチマーク結果 7.1と比べて8倍の性能向上
1分間に10億回の読取り(SELECT) - 8x Intel Xeon x5670, NoSQL C++ API, flexAsynch benchmark
0
2
4
6
8
10
12
14
16
18
20
MySQL Cluster 7.1 MySQL Cluster 7.2
Re
ads
pe
r Se
con
d (
Mill
ion
s)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 11
MySQL Cluster ベンチマーク結果
1分間に43億回の読取り(SELECT) - 30x Intel Xeon E5-2670, NoSQL C++ API, flexAsynch benchmark
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 12
0
5
10
15
20
25
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Mil
lio
ns
of
UP
DA
TE
s p
er
Se
co
nd
MySQL Cluster Data Nodes
MySQL Cluster ベンチマーク結果 非常に高いスケーラビリティ
1分間に12億回の書込み(UPDATE) - 30x Intel Xeon E5-2670, NoSQL C++ API, flexAsynch benchmark
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 13
MySQL Cluster ベンチマーク結果
ホワイトペーパー:
MySQL Cluster ベンチマーク OracleとIntelによる共同テスト:分間10億件の更新処理性能
http://www-jp.mysql.com/why-mysql/white-papers/mysql-cluster-benchmarks.php
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 14
実例テストケース
0
20
40
60
80
100
MySQL Cluster 7.1 MySQL Cluster 7.2
クエリー実行時間 (秒)
70倍高速
87.23 秒
1.26 秒
Webベース・コンテンツ管理システム - 11テーブル、33,500行を結合(JOIN)
- 結果セット:2,060行、1行あたり19列を返す
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 15
ベンチマークの詳細
データ
ノード1
データ
ノード 2
MySQLサーバー
http://clusterdb.com/u/70x
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 16
アダプティブ・クエリー・ローカライゼーション 分散JOINスケーリング
• シャード間で複雑なクエリを実行
• JOIN処理をデータ・ノードに移行
• 並列実行
• 一つの結果セットをMySQLに戻す
• これまででは性能的に難しかった処理も
実行可能に
• リアルタイム分析
• レコメンデーション・エンジン
• クリックストリームを分析
mysqld
データ・ノード
mysqld
A
Q
L
データ・ノード
70倍以上の
パフォーマンス向上
機能性を犠牲にせず、スケールアウトを向上!!
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 17
AQL – 使用方法
ndb_join_pushdown がONで有効(デフォルト)
結合(JOIN)を移行するためのルール: 1. 結合する列のタイプは全て完全に同じ
2. BLOBまたはTEXT列への参照なし
3. 明示的ロックなし 4. 結合内の子テーブルはref、eq_ref、またはconstを使用してアクセス
5. テーブルは[LINEAR] HASH、 LIST、または RANGEを使用して明示的に
パーティショニングされていない 6. クエリー・プランが ‘Using join buffer’ を選択していない
7. 結合のルートが eq_ref または const の場合、子テーブルは eq_refで結合
各テーブルに対し ANALYZE TABLE <tab-name> を実行
EXPLAIN を使用してどのコンポーネントが移行されるか確認: – Extra: Child of 'd' in pushed join@1
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 18
InnoDB と MyISAMの 比較
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 19
MyISAM ストレージエンジン(since 1994)
トランザクション非対応
キャッシュ
– インデックスのみ
– テーブルデータはファイルシステムのキャッシュを利用する
1つテーブルは、同時に複数の書込み処理を実行できない
– ボトルネックになりやすい点
– 回避策:delayed inserts、low priority
極めてシンプルで軽量なアーキテクチャ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 20
InnoDB ストレージエンジン(since 2001)
トランザクション対応 / UNDO
キャッシュ
– Buffer pool にインデックスもテーブルデータもキャッシュ
行レベルロック
マルチスレッド
外部キーのサポート
Auto recovery
ディスクベースのトランザクション対応ストレージエンジンの中で
最速のストレージエンジン
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 21
ベンチマーク結果 : MySQL5.5 Sysbench OLTP_RO
InnoDBはMyISAMより4.6倍処理性能が高い Oracle Linux 5
AMD Opteron 6172
MySQL leveraging:
- 36 of 48 available CPU threads
- 2.1 GHz, 64GB RAM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 22
ベンチマーク結果 : MySQL5.5 Sysbench OLTP_RW
InnoDBはMyISAMより35倍処理性能が高い Oracle Linux 5
AMD Opteron 6172
MySQL leveraging:
- 36 of 48 available CPU threads
- 2.1 GHz, 64GB RAM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 23
ベンチマーク結果 : MySQL5.5 vs 5.6 Sysbench
MySQL5.6では、更に性能向上
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 24
MySQL 5.6での 性能改善点
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 25
InnoDB
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 26
MySQL 5.6: InnoDB Better Performance, Scalability
多くのボトルネックを排除 (e.g. Split kernel mutex)
Read Only の処理に対する最適化
SSD 向けの最適化
可変ページサイズ(4, 8k)
neighbor pageのフラッシュを停止可能
UNDO領域の分離
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 27
MySQL 5.6: InnoDB
Read Only の処理に対する最適化
- 同時実行性が高く、読込みが集中するWebアプリに最適
- 開発者が読込み専用トランザクションのオーバーヘッドを制御可能
SET autocommit = 1;
SELECT c FROM sbtest WHERE id=N;
SET autocommit = 0;
START TRANSACTION READ ONLY;
SELECT c FROM sbtest WHERE id=N;
COMMIT;
デフォルトの状態
読込み専用トランザクションを使用
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 28
MySQL 5.6.7
Scales to 48 CPU Threads
Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
MySQL leveraging:
- 48 of 96 available CPU threads
- 2 GHz, 512GB RAM
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
12 24 36 48
Tra
ns
ac
tio
ns
pe
r S
ec
on
d
CPU Threads
MySQL 5.6 Read Write (Linux)
MySQL 5.6 SysBench Benchmarks
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 29
MySQL 5.6 SysBench Benchmarks
MySQL 5.6.7
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
12 24 36 48
Tra
ns
ac
tio
ns
pe
r S
ec
on
d
CPU Threads
MySQL 5.6 Read Only (Linux)
Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
MySQL leveraging:
- 48 of 96 available CPU threads
- 2 GHz, 512GB RAM Scales to 48 CPU Threads
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 30
MySQL 5.6 SysBench Benchmarks
MySQL 5.5.28
MySQL 5.6.7
Up to 151% Performance Gain
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
32 64 128 256 512
Tra
ns
ac
tio
ns
pe
r S
ec
on
d
Connections
MySQL 5.6 vs. 5.5 - Read Write (Linux)
Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
MySQL leveraging:
- 48 of 96 available CPU threads
- 2 GHz, 512GB RAM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 31
MySQL 5.6 SysBench Benchmarks
MySQL 5.6.7
Up to 234% Performance Gain
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
32 64 128 256 512
Tra
nsacti
on
s p
er
Seco
nd
Connections
MySQL 5.6 vs. 5.5 - Read Only (Linux)
MySQL 5.5.28
Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
MySQL leveraging:
- 48 of 96 available CPU threads
- 2 GHz, 512GB RAM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 32
Optimizer
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 33
MySQL 5.6: Optimizer
LIMIT句で少数のレコードを取得する際のファイル・ソートを最適化
4倍の実行速度 – 40秒から10秒に短縮
インデックス条件のプッシュダウン
実行速度向上 – 15秒から90ミリ秒に短縮
バッチ・キー・アクセスとマルチ・レンジ・リード
実行速度向上 – 2000秒から10秒に短縮
FROMからのビュー/サブクエリの実データ取得を遅延
EXPLAINに対する実行時間を240倍向上 – 8分から2秒に短縮
サブクエリの最適化
実行速度向上 – 日単位から秒単位に短縮
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 34
0 8 16 24 32 40 48 56 64 5
50
500
5000
1225
9.63
2821
No BKA
BKA
Join Buffer Size (MB)
Que
ry Tim
e (秒
)
MySQL 5.6: Optimizer バッチ・キー・アクセス(BKA)およびマルチ・レンジ・リード (MRR)
ディスクアクセスの多いJOINクエリのパフォーマンスを向上
MRR + BKA無しの
実行時間
MRR + BKA有りの実行時間
DBT3 Q3: "Customer Distribution Query"
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 35
MySQL 5.5: MRRが無い場合のデータアクセス
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 36
MySQL 5.6: MRRを使った場合のデータアクセス
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 37
MySQL 5.6: 通常のNested Loop Join
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 38
MySQL 5.6: Batched Key Access(BKA)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 39
参考資料
MySQL Cluster ベンチマーク OracleとIntelによる共同テスト:分間10億件の更新処理性能
http://www-jp.mysql.com/why-mysql/white-papers/mysql-cluster-benchmarks.php
MySQL 5.5: Storage Engine Performance Benchmark for MyISAM and InnoDB
http://www.mysql.com/why-mysql/white-papers/mysql_5.5_perf_myisam_innodb.php
What‘s New in MySQL Server 5.6
http://www.myexpospace.com/oracle2012/SessionFiles/CON8377_PDF_8377_0001.pdf
New Optimizer Features in MySQL 5.6
http://www.myexpospace.com/oracle2012/SessionFiles/CON8979_PDF_8979_0001.pdf
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 40
The world's most popular open source database
世界で最も普及しているオープンソース データベース
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 41
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 42