sysbench で MySQL や PostgreSQL のベンチマークを取得することができるが、OLTP test statistics の write がDML発行回数かI/Oシステムコール発行回数のどちらか気になった。SQLインタフェースでアクセスしているので、DML発行回数だと想定していたが、sysbench のソースを確認したらやはり単純にDML発行回数のようだ。*1
つづいてベンチマークの取得です。
$ sysbench --test=/tmp/sysbench-0.5/sysbench/tests/db/oltp.lua \ > --db-driver=pgsql \ > --pgsql-user=sbuser --pgsql-password=sbpass --pgsql-db=sbdb \ > run sysbench 0.5: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Random number generator seed is 0 and will be ignored Initializing worker threads... Threads started! OLTP test statistics: queries performed: read: 140000 write: 40000 ★ other: 20000 total: 200000 transactions: 10000 (96.53 per sec.) read/write requests: 180000 (1737.48 per sec.) other operations: 20000 (193.05 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) General statistics: total time: 103.5983s total number of events: 10000 total time taken by event execution: 103.5635s response time: min: 4.04ms avg: 10.36ms max: 23.20ms approx. 95 percentile: 10.97ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 103.5635/0.00KKIDA-GALAXY: sysbench 0.5 で PostgreSQL 9.5 のベンチマーク!環境構築編
void db_report_cumulative(sb_stat_t *stat) { sb_timer_t exec_timer; sb_timer_t fetch_timer; /* Use default stats handler if no drivers are used */ if (!check_print_stats()) { sb_report_cumulative(stat); return; } const double seconds = stat->time_interval; const uint64_t queries = stat->reads + stat->writes + stat->other; ★ log_text(LOG_NOTICE, "SQL statistics:"); log_text(LOG_NOTICE, " queries performed:"); log_text(LOG_NOTICE, " read: %" PRIu64, stat->reads); log_text(LOG_NOTICE, " write: %" PRIu64, stat->writes); ★ log_text(LOG_NOTICE, " other: %" PRIu64, stat->other); log_text(LOG_NOTICE, " total: %" PRIu64, queries); log_text(LOG_NOTICE, " transactions: %-6" PRIu64 " (%.2f per sec.)", stat->events, stat->events / seconds); log_text(LOG_NOTICE, " queries: %-6" PRIu64 " (%.2f per sec.)", queries, queries / seconds); log_text(LOG_NOTICE, " ignored errors: %-6" PRIu64 " (%.2f per sec.)", stat->errors, stat->errors / seconds); log_text(LOG_NOTICE, " reconnects: %-6" PRIu64 " (%.2f per sec.)", stat->reconnects, stat->reconnects / seconds);