MySql key performance indicators Description

In general the project which will be the main database performance bottlenecks and load, then for monitoring and optimizing database corresponding to the performance indicators and the main work is to develop operation and maintenance personnel need to face, and the work will be part of this project from development through to run the whole cycle's.

In this article we summarize and explain the calculation of the statistical performance of several major MySql database.

In MySql you can get a lot of performance indicators entries by show global status, from which we can extract the index entries need to focus on:

1, CPU, memory usage, disk space

CPU, memory, disk, we can see these three is the most intuitive indicators also reflect the overall state of MySql running once our database server has three abnormal fluctuations will inevitably affect the stability and performance of the project, so we need to be rational allocation and optimization of projects and MySql.

2, number of connections, number of connections created, the number of connection cache, the number of active connections

Threads_created:

By show global status like "Threads_created" can view the number of connections that have been created, the name suggests is the total number of connections MySql has been created;

Threads_connectd:

By show global status like "Threads_connectd" can view the number of connections are already connected, this value is equal to show processlist;

Threads_catched:

By show global status like "Threads_catched" you can view the current number of connections MySql currently cached, we know very resource-consuming to establish a connection MySql, when an existing connection is no longer used, MySql does not directly disconnect, but the connection cache to buffer pool so that the next time there is a demand create thread to achieve the multiple connections to improve the performance target, the value Threads_catched in the number of connections is currently available, we can come buffer pool values ​​should Threads_created is Threads_connectd with Threads_catched sum, of course, if you already have a middleware or other connection pool management, then this parameter is not so important, but if there is no other connection pool management, the optimization of the parameters or a certain necessary.

Threads_running:

"Threads_running" by show global status like you can view the number of connections currently active, this value represents the number of threads currently active in a connected state, this value must be less than the Threads_connectd.

3、IOPS、QPS、TPS

IOPS: (Input / Output operations Per Second, both the number of requests per second I / O's)

We know to read and write IO process of dealing with the nature of the database, you can simply put IOPS understood as a storage medium (typically disk) IO read and write in unit time can handle the number of requests, because all access to the database and MySql Finally, the operation will fall on the disk read and write, so the more the value of the database processing request IOPS naturally higher in a certain time acceptable, IOPS of formula: IOPS = 1000ms / (seek time + rotational latency ), we can see this indicator is calculated with the performance of your storage media are closely related, so the ordinary mechanical hard disk SSD solid state drive is replaced with a MySql raise one kind of processing power more effective means.

QPS (Query Per Second, both the number of queries per second request)

QPS is a very important indicator of MySql database, which represents the number of requests per second received MySql database queries, we can show global status like to see the current database "Questions" Questions that is, the number of queries, but it should be noted that this value is a global cumulative value, that is, the number of inquiries from all MySql service starts. If we calculate the mean is a database service QPS performance can be directly calculated using the following method:

Show = Questions Global Status like " Questions " ; - after start MySql total number of queries 

AND uptimes = Show Global Status like " Uptime " ; - Run time after this start MySql (unit: seconds) 

QPS = Questions / AND uptimes

If you want to calculate the index is a system peak QPS, which requires us to calculate manually, we may be separated by time units like Status, Ltd. Free Join Show  "Questions" command this query value, and the two adjacent values deduction separated in time, actually requested is obtained accurately counted every second.

TPS(Transcantion Per Second,既每秒事务数)

Since it is a data transactions per second in InnoDB engine will have this indicator data, TPS involves the submission and roll back the transaction, it is necessary to show global status like calculating TPS "Com_commit" and  show global status like "Com_rollback", we also need calculated once per sample intervals, and then Com_commit Com_rollback value divided by the sum of the value of a unit time is the TPS, the following formula:

= Show the commit Global Status like " Com_commit " ; 

ROLLBACK = Show Global Status like " Com_rollback " ; 

the TPS = (the commit ROLLBACK +) / seconds The (per unit time, unit: second)

 4, InnoDB cache read hit rate, utilization, dirty block ratio (%)

In use MySql, since the advantages and characteristics of the InnoDB engine, we usually choose it as MySql data engine, InnoDB has a caching feature can be greatly improved query performance MySql, because not only Innodb cache index, while will cache the actual data, we can use to configure the storage engine Innodb more memory to cache data, in the process of its cache hit rate, utilization rate and the dirty block must be the important performance indicators.

About Innodb There are many parameters indicators:

// innodb file read and write times 

innodb_data_reads: read times per second from a file innodb 

innodb_data_writes: innodb times per second from a file written 

innodb_data_fsyncs: innodb second average of fsync () number of operations 

// innodb read write amount 

innodb_data_read: innodb average amount of data per second read unit KB 

innodb_data_written: innodb average amount of data per second is written in units of KB 

// innodb buffer pool state 

innodb_buffer_pool_reads: read from the physical disk per second page number 

innodb_buffer_pool_read_requests: per second (the number of logical read request) from the number of read buffer pool innodb 

innodb_buffer_pool_write_requests: the number of times per second write buffer pool innodb 

innodb_buffer_pool_pages_dirty: average number per innodb buffer pool dirty page 

innodb_buffer_pool_pages_flushed: average the number of seconds innodb buffer pool refresh the page request

And InnoDB buffer read hit rate, utilization, dirty block ratio (%) is calculated from the primary parameters in accordance with the above

innodb buffer pool read hit ratio = (1 - Innodb_buffer_pool_reads / Innodb_buffer_pool_read_requests) * 100

Innodb buffer pool utilization = (1 - Innodb_buffer_pool_pages_free / Innodb_buffer_pool_pages_total) * 100

The percentage of dirty blocks in the buffer pool Innodb = (innodb_buffer_pool_pages_dirty / innodb_buffer_pool_pages_total) * 100

The network traffic (the input output per second)

Monitoring network traffic data may Bytes_received MySql acquire Bytes_sent within the computing unit time.

Bytes_received / s: the number of bytes per second end received from all clients, in KB

Bytes_sent / s: the average number of bytes transmitted per second to all the clients, in KB

6, MySql queries per second in InnoDB engine, insertions, deletions, update the statistics of the number of

Global MySql database query, insert, delete, update times show global status like "% innodb_rows%" command to see through, and the above-mentioned indicators within the unit of time to acquire InnoDB engine queries per second, number of insertions , delete the number, the number of updates

InnoDB engine queries per second = Innodb_rows_read / s

InnoDB engine insertions per second = Innodb_rows_inserted / s

The number of times per second to delete InnoDB engine = Innodb_rows_deleted / s

The number of times per second to delete InnoDB engine = Innodb_rows_updated / s

 

These are some of the major computing MySql database performance metrics and statistical methods to monitor these performance indicators and statistics, one can monitor the operational status MySql databases, on the other hand can also be located by search and abnormal positioning of certain performance indicators , we want to use for the project MySql database to help, which if insufficient and not the right place also pointed out that hope and generosity.

 

Focus on micro-channel public number to see more technical articles.

 

Guess you like

Origin www.cnblogs.com/dafanjoy/p/12133241.html