MySQL でベンチマーク

#! /bin/bash

host=""
user=""
password=""
loadtypes=(read write key update mixed)
 
for loadtype in ${loadtypes[@]}; do
  if [ "$loadtype" = "key" ]; then
    numberofqueries=10000
  else
    numberofqueries=1000
  fi
    echo "======== ${loadtype} on ${host} (${numberofqueries} times) ========"
    mysqlslap \
      --user=${user} \
      --password=${password} \
      --host=${host} \
      --port=3306 \
      --engine=innodb \
      --auto-generate-sql \
      --auto-generate-sql-load-type=${loadtype} \
      --auto-generate-sql-add-autoincrement \
      --number-char-cols=3 \
      --number-int-cols=5 \
      --number-of-queries=${numberofqueries} \
      --concurrency=3 \
      --iterations=5
done