The meaning and calculation method of QPS and TPS of MySQL database

The meaning and calculation method of QPS and TPS of MySQL database

When doing DB benchmark testing, qps and tps are key indicators for measuring database performance. This article compares two calculation methods available online. Let’s first understand the relevant concepts.

Concept introduction:

  • QPS: Queries Per Second is the number of queries a server can respond to per second. It is a measure of the amount of queries a specific query server handles within a specified time.
  • TPS: Transactions Per Second is the number of transactions per second, which is the number of transactions processed by a database server in a unit of time.

The terms QPS and TPS are often mentioned in database performance monitoring. The following is a brief introduction to the meaning and calculation methods of QPS and TPS in MySQL databases.

1 QPS: Query per second. Here, QPS refers to the total number of queries 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: Transactions per second. The TPS value requested by the client application is obtained in the following way. The calculation method is 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), which is the number of read and write (I/O) operations per second. It is mostly used in databases and other occasions to measure the performance of random access.

The IOPS performance of the storage side is different from the IO on the host side. IOPS refers to how many times the storage can receive access from the host per second. One IO from the host requires multiple accesses to the storage to complete. For example, when the host writes a minimum data block, it also has to go through three steps: "sending a write request, writing data, and receiving a write confirmation", which means three storage end accesses.

The main IOPS testing benchmark tools include Iometer, IoZone, FIO, etc., which can be used comprehensively to test the IOPS of the disk under different situations. For application systems, you need to first determine the load characteristics of the data, then select reasonable IOPS indicators for measurement and comparative analysis, and then choose the appropriate storage media and software system based on this.

Questions records all select and dml queries since mysqld was started, including the number of show command queries. This is somewhat inaccurate. For example, many databases have monitoring systems running, which perform a show query on the database every 5 seconds to obtain the current database status. These queries are recorded in the QPS and TPS statistics, causing a certain amount of "data pollution".

If there are many MyISAM tables in the database, it is more appropriate to use questions for calculation.

If there are many InnoDB tables in the database, it is more appropriate to use the com_* data source for calculation.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Detailed installation and usage of sysbench tool for database performance testing
  • JAVA order interface optimization actual TPS performance increased by 10 times
  • Detailed tutorial on sysbench stress testing of mysql
  • Performance testing QPS+TPS+transaction basics analysis

<<:  How to backup and restore the mysql database if it is too large

>>:  Solve the problem of installing Tenda U12 wireless network card driver on Centos7

Recommend

The latest virtual machine VMware 14 installation tutorial

First, I will give you the VMware 14 activation c...

K3s Getting Started Guide - Detailed Tutorial on Running K3s in Docker

What is k3d? k3d is a small program for running a...

Summary of knowledge points about covering index in MySQL

If an index contains (or covers) the values ​​of ...

Boundary and range description of between in mysql

mysql between boundary range The range of between...

Some notes on mysql self-join deduplication

Let me briefly explain the functional scenario: T...

How to use stored procedures in MySQL to quickly generate 1 million records

Preface When testing, in order to test the projec...

React internationalization react-intl usage

How to achieve internationalization in React? The...

The whole process of installing gogs with pagoda panel and docker

Table of contents 1 Install Docker in Baota Softw...

MySQL efficient query left join and group by (plus index)

mysql efficient query MySQL sacrifices group by t...

Which loop is the fastest in JavaScript?

Knowing which for loop or iterator is right for o...

MySQL: mysql functions

1. Built-in functions 1. Mathematical functions r...

Disabled values ​​that cannot be entered cannot be passed to the action layer

If I want to make the form non-input-capable, I se...

Linux Dig command usage

Dig Introduction: Dig is a tool that queries DNS ...