ablog

不器用で落着きのない技術者のメモ

sysbench で MySQL に負荷をかける

export HOST=rds-mysql-57-22.******.ap-northeast-1.rds.amazonaws.com
export PASSWD=******

nohup sysbench /usr/local/share/sysbench/oltp_read_write.lua \
 --db-driver=mysql \
 --table-size=1000000 \
 --mysql-host=${HOST} \
 --mysql-user=awsuser \
 --mysql-password=${PASSWD} \
 --mysql-db=mydb \
 --db-ps-mode=disable \
 prepare > sysbench_prepare.log 2>&1
  • 負荷をかける
nohup sysbench /usr/local/share/sysbench/oltp_read_write.lua \
 --db-driver=mysql \
 --table-size=1000000 \
 --mysql-db=mydb \
 --mysql-host=${HOST} \
 --mysql-user=awsuser \
 --mysql-password=${PASSWD} \
 --time=300 \
 --db-ps-mode=disable \
 --threads=32 \
 run > sysbench_run.log 2>&1
  • 実行結果A
sysbench 1.1.0-805825f (using bundled LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 16
Initializing random number generator from current time


Initializing worker threads...

Threads started!

SQL statistics:
    queries performed:
        read:                            1126972
        write:                           311196
        other:                           157263
        total:                           1595431
    transactions:                        76765  (639.54 per sec.)
    queries:                             1595431 (13291.74 per sec.)
    ignored errors:                      3733   (31.10 per sec.)
    reconnects:                          0      (0.00 per sec.)

Throughput:
    events/s (eps):                      639.5390
    time elapsed:                        120.0318s
    total number of events:              76765

Latency (ms):
         min:                                   11.71
         avg:                                   25.01
         max:                                  160.56
         95th percentile:                       50.11
         sum:                              1919887.30
  • 実行結果X
sysbench 1.1.0-805825f (using bundled LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 16
Initializing random number generator from current time


Initializing worker threads...

Threads started!

SQL statistics:
    queries performed:
        read:                            1781374
        write:                           497103
        other:                           250324
        total:                           2528801
    transactions:                        123083 (1025.57 per sec.)
    queries:                             2528801 (21070.85 per sec.)
    ignored errors:                      4158   (34.65 per sec.)
    reconnects:                          0      (0.00 per sec.)

Throughput:
    events/s (eps):                      1025.5703
    time elapsed:                        120.0142s
    total number of events:              123083

Latency (ms):
         min:                                    6.99
         avg:                                   15.60
         max:                                  148.99
         95th percentile:                       28.67
         sum:                              1919663.71

Threads fairness:
    events (avg/stddev):           7692.6875/38.11
    execution time (avg/stddev):   119.9790/0.00