We recommend a script for real-time MySQL read-write ratio statistics.

Source: Internet
Author: User

For MySQL read/write ratio statistics, we generally obtain the relevant values by counting "show global status like 'com _ %. Here is a good script. It is a good option to view the read/write ratio of MySQL in real time. Its project home page is http://code.google.com/p/rw-ratio/

Installation and use are simple:

If you use Perl, dependency packages such as DBI and DBD must be indispensable. This script uses the following three packages:

A. Perl-DBI

B. Perl-term-readkey

C. Perl-DBD-MySQL

For the first two packages a and B, find the RPM packages matching the OS version. As for the final C package installation, "libmysqlclient. so.1 *" will not be found. There are many solutions on the Internet, most of which use soft links. However, if libmysqlclient is provided. so.16 and libmysqlclient. in so.15, this method may not work. Therefore, the best method is to use the tar package after installing packages A and B.

# Tar-zxvf DBD-mysql-4.013.tar.gz

# Cd DBD-mysql-4.013

# Perl makefile. pl -- testhost = 127.0.0.1 # It is recommended to specify -- testuser and -- testpassword. This user must at least have all privileges for test. *.

# Make & make test

# Make install

Okay. After the environment is complete, run the script for R/w ratio statistics. Of course, necessary parameters must be added, such as '-- user ':

#./RW-ratio -- Host = localhost -- user = lrngsql -- Port = 3306 -- sleep = 10

Enter password:
Time: XXXX interval: 10 R: XXX Dr: xxx w: xxx dw: XXX Dr/DW: xxx r/W: XXX

Its output items are described in detail in its script, which is stuck here:

= Item B <time>

The timestamp, expressed as a Unix epoch, of the sample.

= Item B <interval>

The number of seconds between the previous sample and the current sample.

= Item B <r>

The total number of database reads.

= Item B <Dr>

The Delta of reads between the previous sample and the current sample.

= Item B <W>

The total number of database writes.

= Item B <DW>

The Delta of writes between the previous sample and the current sample.

= Item B <Dr/DW>

The ratio of reads to writes, calculated using the current Deltas

= Item B <r/W>

The ratio of reads to writes, calculated using the totals

 

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.