Difference between revisions of "Mysqlstap: tutorial dasar"

From OnnoWiki
Jump to navigation Jump to search
(New page: mysqlslap Tutorial : Basics on MySQL Stress Test Tool Here is basic mysqlslap Tutorial to perform MySQL stress test. MySQL comes with mysqlslap, a benchmarking tool which can help you to t...)
 
 
Line 1: Line 1:
mysqlslap Tutorial : Basics on MySQL Stress Test Tool Here is basic mysqlslap Tutorial to perform MySQL stress test. MySQL comes with mysqlslap, a benchmarking tool which can help you to test database servers. For MySQL optimization test, we usually use Major Hayden’s MySQL Tuner Script. This mysqlslap tutorial is for the beginners. One should read in the way we normally handle MySQL database from command line. mysqlslap Tutorial : First Things First Unlike Major Hayden’s script, this benchmarking tool should be used on a test server with the same specifications of the original database server in question and copy of the database. You should not perform the test on Cloud database as a service. We recommend using a 1 GB PVHVM instance at minimum to test if you are testing on Rackspace. This tool mysqlslap, emulate a large number of connections hitting the application server at the same time. Testing parameters are configurable, so we can fine-tune the original database server or decide whether there is need of scaling. You can create an Image of the working production server and simply spin a server on Rackspace. In that case, you need not to import anything. It is the exact replica copy. The user is newer, but understand the basics from the linked previously published article. We are using an Ubuntu instance. Follow the official guide to install only MySQL : Vim https://help.ubuntu.com/14.04/serverguide/mysql.html 1 https://help.ubuntu.com/14.04/serverguide/mysql.html mysqlslap Tutorial Basics on MySQL Stress Test Tool mysqlslap Tutorial : First Steps After Building The Server and Importing the Database So, you have imported the database. Optionally, you can create an user with all privileges from MySQL interactive mode : Vim create user systemtest identified by 'password'; # change password grant all on *.* to systemtest; 1 2 3 create user systemtest identified by 'password'; # change password grant all on *.* to systemtest; The syntax to test a database goes like this : Vim mysqlslap --user=USERNAME --PASSWORD --host=localhost/IP ADDRESS --auto-generate-sql --verbose # change USERNAME, PASSWORD and localhost/IP ADDRESS to right one 1 2 mysqlslap --user=USERNAME --PASSWORD --host=localhost/IP ADDRESS --auto-generate-sql --verbose # change USERNAME, PASSWORD and localhost/IP ADDRESS to right one The above tests against a single client and output will go like this : Vim Benchmark Average number of seconds to run all queries: 0.001 seconds Minimum number of seconds to run all queries: 0.001 seconds Maximum number of seconds to run all queries: 0.001 seconds Number of clients running queries: 1 Average number of queries per client: 0 1 2 3 4 5 6 Benchmark Average number of seconds to run all queries: 0.001 seconds Minimum number of seconds to run all queries: 0.001 seconds Maximum number of seconds to run all queries: 0.001 seconds Number of clients running queries: 1 Average number of queries per client: 0 We can add variables as flag with the above command like : Vim --concurrency=40 # 40 concurrent users --iterations=20 # 20 times queries are executed --number-char-cols # number of var char --number-int-cols # number of columns # full command mysqlslap --user=USERNAME --PASSWORD --host=localhost --concurrency=40 --iterations=20 --auto-generate-sql --verbose 1 2 3 4 5 6 7 8 9 10 --concurrency=40 # 40 concurrent users --iterations=20 # 20 times queries are executed --number-char-cols # number of var char --number-int-cols # number of columns # full command mysqlslap --user=USERNAME --PASSWORD --host=localhost --concurrency=40 --iterations=20 --auto-generate-sql --verbose We can go a bit advanced with SELECT variable to be more specific : Vim mysqlslap --user=root --password --host=localhost --concurrency=40 --iterations=10 --create-schema=wordpress --query="SELECT * FROM wp_commentmeta;" --verbose # change the variable 1 2 mysqlslap --user=root --password --host=localhost --concurrency=40 --iterations=10 --create-schema=wordpress --query="SELECT * FROM wp_commentmeta;" --verbose # change the variable This is a very basic and safe guide to test your MySQL database, there are official guide and books to use the tool more efficiently. Get used with this basic, then you actually can perform on a production server with the log on. Without a bit practice, it is risky to use mysqlslap on production server. Additionally we can measure the parameters like load average, CPU and memory consumption on Rackspace Cloud Monitoring tool. Application servers, specially for WordPress sucks the memory.
+
Perintah dasar
 +
 
 +
mysqlslap --user=USERNAME --PASSWORD --host=localhost/IP ADDRESS --auto-generate-sql --verbose
 +
 
 +
Menambahkan concurrency dan iterations
 +
 
 +
mysqlslap --user=USERNAME --PASSWORD --host=localhost --concurrency=40 --iterations=20 --auto-generate-sql --verbose
 +
 
 +
Contoh perintah ke database wordpress
 +
 
 +
mysqlslap --user=root --password --host=localhost --concurrency=40 --iterations=10 --create-schema=wordpress --query="SELECT * FROM wp_commentmeta;" --verbose
  
Read more at: https://thecustomizewindows.com/2014/10/mysqlslap-tutorial-basics-mysql-stress-test-tool/
 
Copyright © Abhishek Ghosh
 
  
 
==Referensi==
 
==Referensi==
  
 
* https://thecustomizewindows.com/2014/10/mysqlslap-tutorial-basics-mysql-stress-test-tool/
 
* https://thecustomizewindows.com/2014/10/mysqlslap-tutorial-basics-mysql-stress-test-tool/

Latest revision as of 09:30, 8 June 2015

Perintah dasar

mysqlslap --user=USERNAME --PASSWORD --host=localhost/IP ADDRESS --auto-generate-sql --verbose

Menambahkan concurrency dan iterations

mysqlslap --user=USERNAME --PASSWORD --host=localhost --concurrency=40 --iterations=20 --auto-generate-sql --verbose

Contoh perintah ke database wordpress

mysqlslap --user=root --password --host=localhost --concurrency=40 --iterations=10 --create-schema=wordpress --query="SELECT * FROM wp_commentmeta;" --verbose


Referensi