Mengukur SQL - menggunakan mysqlslap

From OnnoWiki
Revision as of 08:31, 22 November 2021 by Randymatheas (talk | contribs) (Created page with "Untuk mengukur kinerja database mysql kita dapat menggunakan mysqlslap. Dengan asumsi root password mysql 123456 hostname localhost Test dapat dilakukan menggunakan contoh p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Untuk mengukur kinerja database mysql kita dapat menggunakan mysqlslap. Dengan asumsi

root password mysql 123456 hostname localhost

Test dapat dilakukan menggunakan contoh perintah dibawah ini,

mysqlslap -v -h localhost -u root -p123456 --auto-generate-sql

Output mysqlslap kira-kira sebagai berikut,

Benchmark Average number of seconds to run all queries: 0.009 seconds Minimum number of seconds to run all queries: 0.009 seconds Maximum number of seconds to run all queries: 0.009 seconds Number of clients running queries: 1 Average number of queries per client: 0

Perintah –auto-generate-sql akan membuat table, execute INSERT query dan simpan dummy data, execute SELECT query untuk mengambil dummy data, kemudian drop table. Untuk melihat apa yang terjadi di belakang layar tambahkan -vvv

mysqlslap -vvv -h localhost -u root --auto-generate-sql -p123456

Membuat 100 concurrent user dan masing-masing mengexecute satu query,

mysqlslap -vvv -h localhost -u root -p123456 --auto-generate-sql --concurrency=100 --number-of-queries=1

Output mysqlslap kira-kira sebagai berikut,

.. .. INSERT INTO t1 VALUES (364531492,'qMa5SuKo4M5OM7ldvisSc6WK9rsG9E8sSixocHdgfa5uiiNTGFxkDJ4EAwWC2e4NL1BpAgWiFRcp1zIH6F1BayPdmwphatwnmzdwgzWnQ6SRxmcvtd6JRYwEKdvuWr'); Generating stats Benchmark Average number of seconds to run all queries: 0.571 seconds Minimum number of seconds to run all queries: 0.571 seconds Maximum number of seconds to run all queries: 0.571 seconds Number of clients running queries: 100 Average number of queries per client: 0

DROP SCHEMA IF EXISTS `mysqlslap`;