flexAsynchによるMySQL Clusterベンチマーク
MySQL Benchmark Tool
https://dev.mysql.com/downloads/benchmarks.html
―概要―
FlexAsynch is a benchmark specifically developed to test scalability of MySQL Cluster.
It is found in any MySQL Cluster source tarball under storage/ndb/test/ndbapi. The features required to
run it in this parallel manner requires a MySQL Cluster 7.x version released after the 15th of October 2011.
The DBT2 Benchmark Tool can be used to run distributed tests with many MySQL Cluster Data nodes and many
flexAsynch benchmark programs in a completely automated fashion.
Mikaelさんが、MySQL Clusterでのベンチマーク方法についての手法を書かれているので、
他のツール含めて検証される場合は此方を参考にすると良さそうです。
Mikael Ronstrom
自分の環境にはSourceやJavaが無かったのでまずダウンロードしてインストールしました。
その他、コンパイラーなどは必要に応じてインストールしてください。
あとは、コンパイルして基本的な動作確認が出来たら、自分が変化を判断し易いように、
標準オプション決めて実行し、古いバージョンや古いシステムから入れ替える時にどれだけ
パフォーマンスが変化していくか確認用に使ってみるのも良いかと思っています。
1) クラスターソースコードのダウンロード
wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.4.6/mysql-cluster-gpl-7.4.6.tar.gz
2) Javaのインストール (今回は、1.8で上手くいかなかったので1.6で実行しました)
[root@Labs01 mysql-cluster-gpl-7.4.6]# yum search jdk 読み込んだプラグイン:fastestmirror Loading mirror speeds from cached hostfile * base: mirror.fairway.ne.jp * extras: mirror.fairway.ne.jp * updates: mirror.fairway.ne.jp ==================================================================== N/S matched: jdk ==================================================================== java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without audio and video support java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle ldapjdk-javadoc.noarch : Javadoc for ldapjdk icedtea-web.x86_64 : Additional Java components for OpenJDK - Java browser plug-in and Web Start implementation ldapjdk.noarch : The Mozilla LDAP Java SDK Name and summary matches only, use "search all" for everything. [root@Labs01 mysql-cluster-gpl-7.4.6]# yum install java-1.6.0-* 読み込んだプラグイン:fastestmirror Loading mirror speeds from cached hostfile * base: mirror.fairway.ne.jp * extras: mirror.fairway.ne.jp * updates: mirror.fairway.ne.jp 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ java-1.6.0-openjdk.x86_64 1:1.6.0.35-1.13.7.1.el7_1 を インストール --> 依存性の処理をしています: tzdata-java のパッケージ: 1:java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64 --> 依存性の処理をしています: libpulse.so.0(PULSE_0)(64bit) のパッケージ: 1:java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64 --> 依存性の処理をしています: libpulse.so.0()(64bit) のパッケージ: 1:java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64 ---> パッケージ java-1.6.0-openjdk-demo.x86_64 1:1.6.0.35-1.13.7.1.el7_1 を インストール ---> パッケージ java-1.6.0-openjdk-devel.x86_64 1:1.6.0.35-1.13.7.1.el7_1 を インストール ---> パッケージ java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.35-1.13.7.1.el7_1 を インストール ---> パッケージ java-1.6.0-openjdk-src.x86_64 1:1.6.0.35-1.13.7.1.el7_1 を インストール --> トランザクションの確認を実行しています。 ---> パッケージ pulseaudio-libs.x86_64 0:3.0-30.el7 を インストール --> 依存性の処理をしています: libsndfile.so.1(libsndfile.so.1.0)(64bit) のパッケージ: pulseaudio-libs-3.0-30.el7.x86_64 --> 依存性の処理をしています: libsndfile.so.1()(64bit) のパッケージ: pulseaudio-libs-3.0-30.el7.x86_64 --> 依存性の処理をしています: libasyncns.so.0()(64bit) のパッケージ: pulseaudio-libs-3.0-30.el7.x86_64 ---> パッケージ tzdata-java.noarch 0:2015d-1.el7 を インストール --> トランザクションの確認を実行しています。 ---> パッケージ libasyncns.x86_64 0:0.8-7.el7 を インストール ---> パッケージ libsndfile.x86_64 0:1.0.25-9.el7 を インストール --> 依存性の処理をしています: libvorbisenc.so.2()(64bit) のパッケージ: libsndfile-1.0.25-9.el7.x86_64 --> 依存性の処理をしています: libvorbis.so.0()(64bit) のパッケージ: libsndfile-1.0.25-9.el7.x86_64 --> 依存性の処理をしています: libogg.so.0()(64bit) のパッケージ: libsndfile-1.0.25-9.el7.x86_64 --> 依存性の処理をしています: libgsm.so.1()(64bit) のパッケージ: libsndfile-1.0.25-9.el7.x86_64 --> 依存性の処理をしています: libFLAC.so.8()(64bit) のパッケージ: libsndfile-1.0.25-9.el7.x86_64 --> トランザクションの確認を実行しています。 ---> パッケージ flac-libs.x86_64 0:1.3.0-5.el7_1 を インストール ---> パッケージ gsm.x86_64 0:1.0.13-11.el7 を インストール ---> パッケージ libogg.x86_64 2:1.3.0-7.el7 を インストール ---> パッケージ libvorbis.x86_64 1:1.3.3-8.el7 を インストール --> 依存性解決を終了しました。 依存性を解決しました ========================================================================================================================================================== Package アーキテクチャー バージョン リポジトリー 容量 ========================================================================================================================================================== インストール中: java-1.6.0-openjdk x86_64 1:1.6.0.35-1.13.7.1.el7_1 updates 42 M java-1.6.0-openjdk-demo x86_64 1:1.6.0.35-1.13.7.1.el7_1 updates 1.9 M java-1.6.0-openjdk-devel x86_64 1:1.6.0.35-1.13.7.1.el7_1 updates 15 M java-1.6.0-openjdk-javadoc x86_64 1:1.6.0.35-1.13.7.1.el7_1 updates 13 M java-1.6.0-openjdk-src x86_64 1:1.6.0.35-1.13.7.1.el7_1 updates 39 M 依存性関連でのインストールをします: flac-libs x86_64 1.3.0-5.el7_1 updates 169 k gsm x86_64 1.0.13-11.el7 base 30 k libasyncns x86_64 0.8-7.el7 base 26 k libogg x86_64 2:1.3.0-7.el7 base 24 k libsndfile x86_64 1.0.25-9.el7 base 149 k libvorbis x86_64 1:1.3.3-8.el7 base 204 k pulseaudio-libs x86_64 3.0-30.el7 base 556 k tzdata-java noarch 2015d-1.el7 updates 144 k トランザクションの要約 ========================================================================================================================================================== インストール 5 パッケージ (+8 個の依存関係のパッケージ) 総ダウンロード容量: 111 M インストール容量: 367 M Is this ok [y/d/N]: y Downloading packages: (1/13): gsm-1.0.13-11.el7.x86_64.rpm | 30 kB 00:00:00 (2/13): flac-libs-1.3.0-5.el7_1.x86_64.rpm | 169 kB 00:00:02 (3/13): java-1.6.0-openjdk-demo-1.6.0.35-1.13.7.1.el7_1.x86_64.rpm | 1.9 MB 00:00:06 (4/13): libasyncns-0.8-7.el7.x86_64.rpm | 26 kB 00:00:00 (5/13): libogg-1.3.0-7.el7.x86_64.rpm | 24 kB 00:00:00 (6/13): libsndfile-1.0.25-9.el7.x86_64.rpm | 149 kB 00:00:00 (7/13): libvorbis-1.3.3-8.el7.x86_64.rpm | 204 kB 00:00:00 (8/13): pulseaudio-libs-3.0-30.el7.x86_64.rpm | 556 kB 00:00:00 (9/13): java-1.6.0-openjdk-devel-1.6.0.35-1.13.7.1.el7_1.x86_64.rpm | 15 MB 00:00:59 (10/13): tzdata-java-2015d-1.el7.noarch.rpm | 144 kB 00:00:01 (11/13): java-1.6.0-openjdk-javadoc-1.6.0.35-1.13.7.1.el7_1.x86_64.rpm | 13 MB 00:01:04 (12/13): java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64.rpm | 42 MB 00:01:49 (13/13): java-1.6.0-openjdk-src-1.6.0.35-1.13.7.1.el7_1.x86_64.rpm | 39 MB 00:02:12 ----------------------------------------------------------------------------------------------------------------------------------------------------------合計 816 kB/s | 111 MB 00:02:19 Running transaction check Running transaction test Transaction test succeeded Running transaction インストール中 : 2:libogg-1.3.0-7.el7.x86_64 1/13 インストール中 : flac-libs-1.3.0-5.el7_1.x86_64 2/13 インストール中 : 1:libvorbis-1.3.3-8.el7.x86_64 3/13 インストール中 : gsm-1.0.13-11.el7.x86_64 4/13 インストール中 : libsndfile-1.0.25-9.el7.x86_64 5/13 インストール中 : tzdata-java-2015d-1.el7.noarch 6/13 インストール中 : libasyncns-0.8-7.el7.x86_64 7/13 インストール中 : pulseaudio-libs-3.0-30.el7.x86_64 8/13 インストール中 : 1:java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64 9/13 インストール中 : 1:java-1.6.0-openjdk-demo-1.6.0.35-1.13.7.1.el7_1.x86_64 10/13 インストール中 : 1:java-1.6.0-openjdk-src-1.6.0.35-1.13.7.1.el7_1.x86_64 11/13 インストール中 : 1:java-1.6.0-openjdk-devel-1.6.0.35-1.13.7.1.el7_1.x86_64 12/13 インストール中 : 1:java-1.6.0-openjdk-javadoc-1.6.0.35-1.13.7.1.el7_1.x86_64 13/13 検証中 : libsndfile-1.0.25-9.el7.x86_64 1/13 検証中 : libasyncns-0.8-7.el7.x86_64 2/13 検証中 : 1:java-1.6.0-openjdk-demo-1.6.0.35-1.13.7.1.el7_1.x86_64 3/13 検証中 : flac-libs-1.3.0-5.el7_1.x86_64 4/13 検証中 : tzdata-java-2015d-1.el7.noarch 5/13 検証中 : pulseaudio-libs-3.0-30.el7.x86_64 6/13 検証中 : 1:java-1.6.0-openjdk-javadoc-1.6.0.35-1.13.7.1.el7_1.x86_64 7/13 検証中 : gsm-1.0.13-11.el7.x86_64 8/13 検証中 : 2:libogg-1.3.0-7.el7.x86_64 9/13 検証中 : 1:java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el7_1.x86_64 10/13 検証中 : 1:java-1.6.0-openjdk-src-1.6.0.35-1.13.7.1.el7_1.x86_64 11/13 検証中 : 1:java-1.6.0-openjdk-devel-1.6.0.35-1.13.7.1.el7_1.x86_64 12/13 検証中 : 1:libvorbis-1.3.3-8.el7.x86_64 13/13 インストール: java-1.6.0-openjdk.x86_64 1:1.6.0.35-1.13.7.1.el7_1 java-1.6.0-openjdk-demo.x86_64 1:1.6.0.35-1.13.7.1.el7_1 java-1.6.0-openjdk-devel.x86_64 1:1.6.0.35-1.13.7.1.el7_1 java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.35-1.13.7.1.el7_1 java-1.6.0-openjdk-src.x86_64 1:1.6.0.35-1.13.7.1.el7_1 依存性関連をインストールしました: flac-libs.x86_64 0:1.3.0-5.el7_1 gsm.x86_64 0:1.0.13-11.el7 libasyncns.x86_64 0:0.8-7.el7 libogg.x86_64 2:1.3.0-7.el7 libsndfile.x86_64 0:1.0.25-9.el7 libvorbis.x86_64 1:1.3.3-8.el7 pulseaudio-libs.x86_64 0:3.0-30.el7 tzdata-java.noarch 0:2015d-1.el7 完了しました! [root@Labs01 mysql-cluster-gpl-7.4.6]# which java /bin/java [root@Labs01 mysql-cluster-gpl-7.4.6]# /bin/java -version java version "1.6.0_35" OpenJDK Runtime Environment (IcedTea6 1.13.7) (rhel-1.13.7.1.el7_1-x86_64) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode) [root@Labs01 mysql-cluster-gpl-7.4.6]#
2) ソースコードの解凍(tar xzf mysql-cluster-gpl-7.4.6.tar.gz) とクラスターのビルド
※746binは、インストール先用に用意したフォルダーですので何でも良いです。
[root@Labs01 mysql-cluster-gpl-7.4.6]# echo $PATH /sbin:/bin:/usr/sbin:/usr/bin [root@Labs01 mysql-cluster-gpl-7.4.6]# readlink $(readlink $(which java)) /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java [root@Labs01 mysql-cluster-gpl-7.4.6]# echo "export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64" >> /root/.bashrc [root@Labs01 mysql-cluster-gpl-7.4.6]# [root@Labs01 mysql-cluster-gpl-7.4.6]# cmake . -DCMAKE_INSTALL_PREFIX=/addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin -DWITH_NDB_TEST=ON [root@Labs01 mysql-cluster-gpl-7.4.6]# make -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.35.x86_64/include /bin/ar: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/libmysqld/libmysqld.a を作成しています Hup.... [ 98%] Built target mysqlserver Scanning dependencies of target mysql_client_test_embedded [100%] Building C object libmysqld/examples/CMakeFiles/mysql_client_test_embedded.dir/__/__/tests/mysql_client_test.c.o Linking CXX executable mysql_client_test_embedded [100%] Built target mysql_client_test_embedded Scanning dependencies of target mysql_embedded [100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o [100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o [100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o Linking CXX executable mysql_embedded [100%] Built target mysql_embedded Scanning dependencies of target mysqltest_embedded [100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o Linking CXX executable mysqltest_embedded [100%] Built target mysqltest_embedded Scanning dependencies of target my_safe_process [100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o Linking CXX executable my_safe_process [100%] Built target my_safe_process [root@Labs01 mysql-cluster-gpl-7.4.6]# [root@Labs01 mysql-cluster-gpl-7.4.6]# make install [ 0%] Built target INFO_BIN [ 0%] Built target INFO_SRC [ 0%] Built target abi_check [ 1%] Built target zlib [ 2%] Built target yassl [ 4%] Built target taocrypt [ 6%] Built target edit [ 8%] Built target strings [ 13%] Built target mysys [ 13%] Built target dbug [ 13%] Built target mysys_ssl [ 13%] Built target comp_err [ 13%] Built target GenError [ 13%] Built target csv [ 13%] Built target csv_embedded [ 14%] Built target myisammrg [ 15%] Built target myisammrg_embedded [ 15%] Built target federated [ 15%] Built target federated_embedded [ 21%] Built target innobase [ 27%] Built target innobase_embedded [ 27%] Built target archive [ 27%] Built target archive_embedded Hup.... -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/innotest2 -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/server-cfg -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/test-insert -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/innotest2a -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/innotest1 -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/bench-count-distinct -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/graph-compare-results -- Installing: /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/sql-bench/copy-db [root@Labs01 mysql-cluster-gpl-7.4.6]#
3) クラスター管理ノードでコンフィグファイルを編集して、テスト用に今回ビルドしたAPIノードを追加。
[api]
NodeId=60
Hostname=192.168.56.108
コンフィグファイルをリロードして新しいノードIDがロードされている事を確認
[root@cluster74_01 data]# /usr/local/mysql/bin/ndb_mgmd -f /usr/local/mysql/mysql-cluster/ndb-config.ini --reload
4) 実際にflexAsynchを実行してみます
ここでは、オプションの指定をせずに接続先のみ指定して実行してみます。
[root@Labs01 mysql-cluster-gpl-7.4.6]# export LD_LIBRARY_PATH=/addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/lib [root@Labs01 mysql-cluster-gpl-7.4.6]# export NDB_CONNECTSTRING=192.168.56.114:1186 [root@Labs01 mysql-cluster-gpl-7.4.6]# /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/bin/flexAsynch FLEXASYNCH - Starting normal mode Perform benchmark of insert, update and delete transactions 1 number of concurrent threads 32 number of parallel operation per thread 500 transaction(s) per round 1 iterations Load Factor is 80% 1 tables 25 attributes per table 0 ordered indexes per table 1 is the number of 32 bit words per attribute Tables are with logging Transactions are executed with hint provided No force send is used, adaptive algorithm used Key Errors are disallowed Temporary Resource Errors are allowed Insufficient Space Errors are disallowed Node Recovery Errors are allowed Overload Errors are allowed Timeout Errors are allowed Internal NDB Errors are allowed User logic reported Errors are allowed Application Errors are disallowed Using table name TAB0_1807968432 CPU for this connection: 0 NdbAPI node with id = 60 Waiting for ndb to become ready... Creating TAB0_1807968432... numFragments = 2 number of nodes = 2 All NDB objects and table created Loop # 1 Executing inserts 16000 transactions, 16000 insert total time = 4376 ms Average 0.273500 ms/transaction, 0.273500 ms/insert. 0.228519 transactions/second, 3656.307130 inserts/second. Executing reads 16000 transactions, 16000 read total time = 1668 ms Average 0.104250 ms/transaction, 0.104250 ms/read. 0.599520 transactions/second, 9592.326139 reads/second. Executing updates 16000 transactions, 16000 update total time = 3913 ms Average 0.244562 ms/transaction, 0.244562 ms/update. 0.255558 transactions/second, 4088.934321 updates/second. Hup... Executing deletes 16000 transactions, 16000 delete total time = 3818 ms Average 0.238625 ms/transaction, 0.238625 ms/delete. 0.261917 transactions/second, 4190.675746 deletes/second. -------------------------------------------------- Dropping table TAB0_1807968432... insert average: 3656/s min: 3656/s max: 3656/s stddev: 0% update average: 4088/s min: 4088/s max: 4088/s stddev: 0% delete average: 4190/s min: 4190/s max: 4190/s stddev: 0% read average: 9774/s min: 9592/s max: 9956/s stddev: 1% NDBT_ProgramExit: 0 - OK [root@Labs01 mysql-cluster-gpl-7.4.6]#
FLEXASYNCHオプション
FLEXASYNCH Perform benchmark of insert, update and delete transactions Arguments: -t Number of threads to start, default 1 -p Number of parallel transactions per thread, default 32 -o Number of transactions per loop, default 500 -l Number of loops to run, default 1, 0=infinite -load_factor Number Load factor in index in percent (40 -> 99) -a Number of attributes, default 25 -c Number of operations per transaction -s Size of each attribute, default 1 (PK is always of size 1, independent of this value) -simple Use simple read to read from database -dirty Use dirty read to read from database -write Use writeTuple in insert and update -n Use standard table names -no_table_create Don't create tables in db -temp Create table(s) without logging -no_hint Don't give hint on where to execute transaction coordinator -adaptive Use adaptive send algorithm (default) -force Force send when communicating -non_adaptive Send at a 10 millisecond interval -local 1 = each thread its own node, 2 = round robin on node per parallel trans 3 = random node per parallel trans -ndbrecord Use NDB Record -r Number of extra loops -insert Only run inserts on standard table -read Only run reads on standard table -update Only run updates on standard table -delete Only run deletes on standard table -create_table Only run Create Table of standard table -drop_table Only run Drop Table on standard table -warmup_time Warmup Time before measurement starts -execution_time Execution Time where measurement is done -cooldown_time Cooldown time after measurement completed -table Number of standard table, default 0 -num_tables Number of tables in benchmark, default 1 -num_indexes Number of ordered indexes per table in benchmark, default 0 -receive_cpus A set of CPUs for receive threads, one per connection, comma separated list with ranges, e.g. 0-2,4
例)オプションを変更してみると以下のように同時接続、トランザクション数等が確認出来る。
必要に応じて、パラメータを変更してください。
[root@Labs01 mysql-cluster-gpl-7.4.6]# /addisk/flexAsynch/mysql-cluster-gpl-7.4.6/746bin/bin/flexAsynch -t 1 -p 30 -l 2 -o 10 -c 100 -n -a 2 FLEXASYNCH - Starting normal mode Perform benchmark of insert, update and delete transactions 1 number of concurrent threads 30 number of parallel operation per thread 10 transaction(s) per round 2 iterations Load Factor is 80% 1 tables 2 attributes per table 0 ordered indexes per table 1 is the number of 32 bit words per attribute Tables are with logging Transactions are executed with hint provided No force send is used, adaptive algorithm used
flexAsynchのCPU Loadもきちんとデータノード間で、分散されている事が確認出来る。
参考:
Mikael Ronstrom
Benchmark MySQL Cluster using flexAsynch
The installation and use of flexAsynch testing tool of MySQL clusters