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