


Detailed explanation of MySQL performance indicators and calculation methods
Most MySQL performance indicators can be obtained in the following two ways:
MySQL performance indicators obtained using the mysqladmin extended-status command default to cumulative values. If you want to understand the current status, you need to calculate the difference; add the parameter --relative(-r), you can see the difference of each indicator, and use the parameter --sleep(-i) Specify how often to refresh.
Can list various status values of MySQL server running, cumulative value.
Mysqladmin extended-status command and show global status get a lot of indicator items. In practical applications, focus on the following performance indicators:
tps: Transactions Per Second, number of transactions per second;
qps: Queries Per Second Number of queries per second;
There are usually two ways to calculate tps/qps:
Method 1: Calculate tps based on com_commit and com_rollback, and calculate qps based on questions.
TPS = Com_commit/s Com_rollback/s
in,
Com_commit /s= mysqladmin extended-status --relative --sleep=1|grep -w Com_commit
Com_rollback/s = mysqladmin extended-status --relative --sleep=1|grep -w Com_rollback
QPS refers to the total amount of Query executed by MySQL Server per second, which is approximately represented by the change in the Questions (number of customer queries) status value per second, so there are:
QPS = mysqladmin extended-status --relative --sleep=1|grep -w Questions
You can also get the number of mysql select, insert, update, delete, etc. per second by following the above method, such as:
Com_select/s = mysqladmin extended-status --relative --sleep=1|grep -w Com_select
Com_select/s: Average number of select statement executions per second
Com_insert/s: average number of insert statement executions per second
Com_update/s: Average number of update statement executions per second
Com_delete/s: average number of delete statement executions per second
Method 2: Calculate tps based on com_%, qps
tps= Com_insert/s Com_update/s Com_delete/s
qps=Com_select/s Com_insert/s Com_update/s Com_delete/s
threads_running: The number of threads currently active
threads_connected: The number of currently connected threads
Bytes_received/s: Average number of bytes received from all clients per second, unit KB
Bytes_sent/s: The average number of bytes sent to all clients per second, unit KB
innodb_data_reads: The average number of times innodb reads from the file per second
innodb_data_writes: The average number of times innodb writes from the file per second
innodb_data_fsyncs: The average number of fsync() operations performed by innodb per second
innodb_data_read: The average amount of data read by innodb per second, in KB
innodb_data_written: The average amount of data written by innodb per second, in KB
innodb_buffer_pool_reads: Average number of pages read from the physical disk per second
innodb_buffer_pool_read_requests: Average number of reads from the innodb buffer pool per second (number of logical read requests)
innodb_buffer_pool_write_requests: Average number of writes to the innodb buffer pool per second
innodb_buffer_pool_pages_dirty: The average number of dirty pages in the innodb cache pool per second
innodb_buffer_pool_pages_flushed: The average number of page refresh requests in the innodb cache pool per second
Innodb buffer pool read hit rate
innodb_buffer_read_hit_ratio = ( 1 - Innodb_buffer_pool_reads/Innodb_buffer_pool_read_requests) * 100
Innodb buffer pool utilization
Innodb_buffer_usage = ( 1 - Innodb_buffer_pool_pages_free / Innodb_buffer_pool_pages_total) * 100
innodb_os_log_fsyncs: Average number of fsync() writes to the log file per second
innodb_os_log_written: Average number of bytes written to the log file per second
innodb_log_writes: Average number of physical writes to the log file per second
innodb_log_write_requests: Average number of log write requests per second
innodb_rows_deleted: The average number of rows deleted from the innodb table per second
innodb_rows_inserted: Average number of rows inserted from the innodb table per second
innodb_rows_read: The average number of rows read from the innodb table per second
innodb_rows_updated: The average number of rows updated from the innodb table per second
innodb_row_lock_waits: The number of times a row must wait for a lock
innodb_row_lock_time: The total time spent on row locking, in milliseconds
innodb_row_lock_time_avg: average row lock time, in milliseconds
key_read_requests: The average number of MyISAM reads from the buffer pool per second
Key_write_requests: The average number of MyISAM writes from the buffer pool per second
key_reads: The average number of times MyISAM reads from the hard disk per second
key_writes: The average number of times MyISAM writes from the hard disk per second
MyISAM average key buffer utilization per second
Key_usage_ratio =Key_blocks_used/(Key_blocks_used Key_blocks_unused)*100
MyISAM average key buffer read hit rate per second
Key_read_hit_ratio=(1-Key_reads/Key_read_requests)*100
MyISAM average key buffer write hit rate per second
Key_write_hit_ratio =(1-Key_writes/Key_write_requests)*100
Created_tmp_disk_tables: The number of temporary tables automatically created on the hard disk when the server executes a statement
Created_tmp_tables: The number of temporary tables in memory that are automatically created when the server executes a statement
The ratio of Created_tmp_disk_tables/Created_tmp_tables should not exceed 10%. If the value of Created_tmp_tables is relatively large, there may be too many sorting sentences or the connection sentences are not optimized enough
slow_queries: Number of queries whose execution time exceeds long_query_time seconds (important)
sort_rows: Number of sorted rows
open_files: Number of open files
open_tables: Number of currently open tables
select_scan: The number of joins for a full scan of the first table
In addition, there are some performance indicators that cannot be obtained directly through mysqladmin extended-status or show global status, but they are very important.
Percona provides the tcprstat tool to count response times. This function is turned off by default. This function can be turned on by setting the parameter query_response_time_stats=1.
There are two ways to check the response time:
(1) View response time statistics through the command SHOW QUERY_RESPONSE_TIME;
(2) View through the table QUERY_RESPONSE_TIME in INFORMATION_SCHEMA.
http://www.orczhou.com/index.php/2011/09/thanks-percona-response-time-distribution/comment-page-1/(reference article)
You can execute the show slave status\G command on the slave node. The value of the Seconds_Behind_Master item is the current delay of the slave, in seconds.
The above is the detailed content of Detailed explanation of MySQL performance indicators and calculation methods. For more information, please follow other related articles on the PHP Chinese website!

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software