プレイヤーズ・ハイ

 雑多な日記

設定別 redis-benchmark 比較

元も子もない結論が待っていますので,お忙しい方は最下段を読んでください。

環境

redis-server

  • Amazon Linux AMI (HVM) 2013.09.2 - ami-eb0c6fea
  • cr1.8xlarge

redis client

  • Amazon Linux AMI 2013.09.2 - ami-0d13700c (64-bit)
  • m1.small

Redis のインストール

以下のシェルスクリプトでインストールします。

install redis 2.8 to Amazon Linux

設定変更

$ sudo vi /etc/redis/6379.conf

pidfile /var/run/redis_6379.pid
logfile /var/log/redis_6379.log

ベンチマーク

redis-server の設定はデフォルトで redis-benchmark をかけてみます。

  • ドノーマル

$ redis-benchmark -h 'redis-server's IP Address -t set,get -q -l

  • パフォーマンス

    • SET 15,258
    • GET 15,639
  • デーモン化

daemonize yes
  • パフォーマンス

    • SET 16,262
    • GET 16,194
  • save しない

save ""
  • パフォーマンス

    • SET 15,478
    • GET 15,591
  • TCP keepalive オン

tcp-keepalive 60
  • パフォーマンス

    • SET 16,424
    • GET 16,210
  • hz 100

hz 100
  • パフォーマンス

    • SET 15,914
    • GET 15,903
  • dir 変更

dir /media/ephemeral0/redis/6379
  • パフォーマンス

    • SET 16,096
    • GET 16,151
  • net.core.somaxconn を増やす

$ sysctl net.core.somaxconn
net.core.somaxconn = 128

$ sudo sysctl -w net.core.somaxconn=1024
net.core.somaxconn = 1024
  • パフォーマンス
    • SET 15,982
    • GET 15,834

と,色んなチューニングっぽいことをやってみましたが redis-benchmark の結果は,ほぼ横ばいでした。

しかし,redis client 側の EC2 インスタンスを m1.small から c1.xlarge に変えると,set も get も 28,000 QPS くらいまで上がりました。

ページの先頭に戻る