开发者

How to measure "queries per second"?

In literature SQL query efficiency is often measured in "queries pre se开发者_如何学运维cond" (QPS). How those measures are made, considering that I have a database with production data at my hands? Is there a MySQL tool that can to this?


 # mysqladmin status

Uptime: 587  Threads: 121  Questions: 3456  Slow queries: 0  Opens: 152  Flush tables: 1  Open tables: 64  Queries per second avg: 5.888


The easiest way to do this is to create a job that runs:

SHOW STATUS LIKE 'Queries'\G;

at specified intervals. This will return the "queries" value. Take the difference between successive calls and then divide by the number of seconds between measurements to get the queries per second.


If you are on linux, you can use a tool called MyTop for realtime analytics.


Playing with #service mysql status returns those informations (based on mysqladmin binary) :

root@SERVER:~# service mysql status
[info] /usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.44, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.5.44-0+deb7u1
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 1 day 6 hours 36 min 1 sec

Threads: 2  Questions: 332928  Slow queries: 0  Opens: 104  Flush tables: 1  Open tables: 59  Queries per second avg: 3.022.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜