Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The significance and calculation method of QPS and TPS in Mysql Database

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When doing db benchmarking, qps,tps is a key indicator of database performance. In this paper, two calculation methods on the Internet are compared. Let's first understand the relevant concepts.

Concept introduction:

The number of QPS:Queries Per Second queries per second is the corresponding number of queries per second by a server, and is a measure of the number of queries handled by a particular query server within a specified period of time. TPS: Transactions Per Second is the number of transactions per second, which is the number of transactions processed by a database server per unit time.

The terms QPS and TPS are often mentioned in the performance monitoring of the database, so let's briefly share the meaning and calculation method of QPS and TPS in the MySQL database.

1 QPS: Query per second. Here QPS refers to the total amount of Query executed by MySQL Server per second. The calculation method is as follows:

Questions = SHOW GLOBAL STATUS LIKE 'Questions';Uptime = SHOW GLOBAL STATUS LIKE' Uptime';QPS=Questions/Uptime

2 TPS: the number of transactions per second. The TPS value requested by the client application is obtained in the following ways, calculated as follows:

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

IOPS: (Input/Output Operations Per Second), that is, the number of read and write operations per second, which is mostly used in databases and other situations to measure the performance of random access.

The performance of the IOPS on the storage side is different from that of the IO on the host side. IOPS refers to the number of accesses sent by the host per second. An IO of the host needs to access the storage multiple times. For example, when a host writes a smallest data block, it also goes through three steps: "send a write request, write data, and receive a write acknowledgement", that is, access by three storage sides.

IOPS's test benchmark tools mainly include Iometer, IoZone, FIO and so on, which can be used to test disk IOPS in different situations. For the application system, it is necessary to determine the load characteristics of the data first, and then select a reasonable IOPS index for measurement and comparative analysis, so as to select the appropriate storage medium and software system.

Questions is the number of queries that record all select,dml times including the show command since mysqld was started. This is somewhat inaccurate, for example, many databases have monitoring systems running, and show queries are made to the database every 5 seconds to obtain the status of the current database, and these queries are recorded in QPS,TPS statistics, resulting in some "data pollution".

If there are more myisam tables in the database, the calculation is more appropriate than questions.

If there are a large number of innodb tables in the database, the com_* data source is more appropriate for the calculation.

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report