Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazeburo/9014939 to your computer and use it in GitHub Desktop.
Save kazeburo/9014939 to your computer and use it in GitHub Desktop.

mroongaでクエリを投げる並列数をあげていくと、レスポンスが悪化する件

使用しているデータは http://blog.livedoor.jp/staff/ の記事データです。1500件ほどあります

環境は EC2 cc2.8xlarge 8コア 32コア

MySQL 5.6.15。オラクル公式MySQL rpmを使用
mroonga 4.0
groonga 4.0

mroongaのビルドは http://blog.nomadscafe.jp/2013/12/vagrantprovisionermroongarpm---mysql-casual-advent-calendar-2013.html この方法でビルドしたもの

セットアップ手順

wget http://nomadscafe.jp/mroonga/mroonga-rpm.tar
wget http://nomadscafe.jp/mroonga/my.cnf
wget http://nomadscafe.jp/mroonga/bench.pl
wget http://nomadscafe.jp/mroonga/blog30.sql
tar xf mroonga-rpm.tar
rpm -Uvh mroonga-rpm/MySQL-shared-compat*.rpm
cp my.cnf /etc/my.cnf
rpm -Uvh mroonga-rpm/MySQL-client-5*.rpm mroonga-rpm/MySQL-devel-5*.rpm \
  mroonga-rpm/MySQL-server-5*.rpm mroonga-rpm/MySQL-shared-5*.rpm
/etc/init.d/mysql start
export MYSQL_PWD=$(tail -2 /root/.mysql_secret | awk -F ': ' '{print $2}')
mysqladmin -uroot  password ""
export MYSQL_PWD=""
mysql -uroot -e 'update user SET Password="" where User="root"' mysql
rpm -Uvh mroonga-rpm/groonga*.rpm mroonga-rpm/mecab*.rpm mroonga-rpm/mysql56-mroonga*.rpm
yum -y install perl-DBD-mysql perl-Time-HiRes
mysqladmin create article_index
cat blog30.sql | mysql article_index

ベンチマーク実行

perl bench.pl 並列数

最後にかかった時間がでます

結果

# perl bench.pl 1
done: 11.0142660140991
# perl bench.pl 2
done: 14.6641170978546
# perl bench.pl 3
done: 12.7114961147308
# perl bench.pl 4
done: 13.4998869895935
# perl bench.pl 5
done: 17.3568599224091
# perl bench.pl 6
done: 22.2315490245819
# perl bench.pl 7
done: 30.3295059204102
# perl bench.pl 8
done: 43.5253119468689
# perl bench.pl 16
done: 126.63294506073

並列数3~4を超えると線形に悪くなっていく

@kazeburo
Copy link
Author

Enable Transparent Huge Pages

# echo 'always' > /sys/kernel/mm/transparent_hugepage/enabled
# perl bench.pl 1
done: 11.2478802204132
# perl bench.pl 2
done: 12.5930590629578
# perl bench.pl 3
done: 9.81607699394226
# perl bench.pl 4
done: 13.3511309623718
# perl bench.pl 5
done: 17.5803909301758
# perl bench.pl 6
done: 22.4946398735046
# perl bench.pl 7
done: 29.6415500640869
# perl bench.pl 8 
done: 42.2584500312805

Disable Transparent Huge Pages

# echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
# perl bench.pl 1
done: 8.79889822006226
# perl bench.pl 2
done: 12.0252130031586
# perl bench.pl 3
done: 13.0487220287323
# perl bench.pl 4
done: 9.82021903991699
# perl bench.pl 5 
done: 11.6668729782104
# perl bench.pl 6 
done: 14.4229891300201
# perl bench.pl 7 
done: 17.8033969402313
# perl bench.pl 8 
done: 22.2788860797882
# perl bench.pl 16
done: 100.067826032639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment