MySQL Database statistics QPS script

Source: Internet
Author: User

The following footsteps are statistics on the MySQL database for the QPS script:

#!/bin/bash

Mysqladmin-uroot-p ' xxxx ' Extended-status-i1|awk ' begin{local_switch=0;print ' QPS Commit Rollback TPS Threads_con Th reads_run\n-------------------------------------------------------"}

$ ~/queries$/{q=$4-lq;lq=$4;}

$/com_commit$/{c=$4-lc;lc=$4;}

$/com_rollback$/{r=$4-lr;lr=$4;}

$/threads_connected$/{tc=$4;}

$/threads_running$/{tr=$4;

if (local_switch==0)

{local_switch=1;count=0}

else {

if (count>10)

{count=0;print "-------------------------------------------------------\nqps Commit Rollback TPS Threads_con Threads _run\n-------------------------------------------------------";}

else{

Count+=1;

printf "%-6d%-8d%-7d%-8d%-10d%d \ n", q,c,r,c+r,tc,tr;

}

}

}‘

The result after execution is:

QPS Commit Rollback TPS Threads_con threads_run

-------------------------------------------------------

35 7 0 7 182 1

1 0 0 0 182 1

7 1 0 1 182 1

11 2 0 2 182 1

10 1 0 1 182 1

90 9 0 9 182 1

316 42 0 42 182 1

1 0 0 0 182 1

15 1 0 1 182 1

16 2 0 2 182 1

267 38 0 38 183 1

However, this script dynamically views MySQL of the QPS and related situation!!!


This article is from a "a little" blog, make sure to keep this source http://pengai.blog.51cto.com/6326789/1887266

MySQL Database statistics QPS script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.