when doing DB benchmarking, Qps,tps is a key metric for measuring database performance. This paper compares two kinds of calculation methods on the Internet. Let's take a look at the relevant concepts.
Concept Introduction:qps:queries per Second query amount/Second, is a server per second can be the corresponding number of queries, is a specific query server in the specified time the amount of queries processed by the measure of how much. tps:transactions per Second is the number of transactions per second, which is the number of transactions that a database server processes within a unit of time.
how to calculate:See the following two ways to get MySQL Qps,tps from the Web:
method One calculates the QPS based on questions, calculates the TPS based on the Com_commit com_rollbackquestions = Show global status like ' questions ';uptime = Show global status like ' uptime ';Qps=questions/uptime Com_commit = Show global status like ' Com_commit ';Com_rollback = Show global status like ' Com_rollback ';uptime = Show global status like ' uptime ';tps= (com_commit + com_rollback)/uptime
Method Two calculates TPS based on the status variable of com_*, QPSuse the following command:show global Status where Variable_name in (' Com_select ', ' com_insert ', ' com_delete ', ' com_update ');gets the value of the com_* interval of 1s and makes a difference operationDel_diff = (int (mystat2[' com_delete '))-int (mystat1[' com_delete '])/diffIns_diff = (int (mystat2[' Com_insert '))-int (mystat1[' com_insert '])/diffSel_diff = (int (mystat2[' com_select '))-int (mystat1[' com_select '])/diffUpd_diff = (int (mystat2[' com_update '))-int (mystat1[' com_update '])/diff
is the value of the above calculation method accurate and appropriate? it was the result of my hand-done test:
a statistics on the various amounts of DML operations for MySQL InnoDB tables, with the following results:the conclusion can be drawn:
1 Com_commit, Com_rollback is not related to displaying the specified transaction, but only with explicit commit commit rollback.
2 com_* will increase by 1 regardless of whether DML results are successful.
b test for the MyISAM table:
1 DML operations for MyISAM tables only questions change the other values unchanged.
2 It is not accurate for the MyISAM storage engine to use com_* to calculate its tps,qps, and it is relatively appropriate to use the questions value calculation. Use the script to get a comparison of the Qps,tps of the database using different variables:qps_s is based on Com_selectQps_ques is based on questions,Tps_iud is based on Com_insert, Com_update,com_delete, andTps_com_rol is based on the sum of Com_commit com_rollbackIt is larger to be viewable based on questions than Com_select based, because questions itself is a collection of all DB accesses.
Summary:Questions is the number of queries that have recorded all select,dml times including the show command since Mysqld started. This is somewhat inaccurate, such as many databases have a monitoring system running, every 5 seconds to the database to do a show query to get the current database status, and these queries are recorded in the QPS,TPS statistics, resulting in a certain "data pollution."If there are more MyISAM tables in the database, it is appropriate to calculate or questions. If there are more InnoDB tables in the database, it is appropriate to calculate the com_* data source.
How "MySQL" Calculates TPS,QPS