Mysqladmin in the SuSElinux System -- The sleep parameter usage is inaccurate.
We all know that in MySQL, you can use the extended-status option of the mysqladmin command to view the running status of MySQL, for example, to obtain the values that we often pay attention:
# mysqladmin -uroot -proot ext |grep "Questions\|Queries\|Innodb_rows\|Com_select \|Com_insert \|Com_update \|Com_delete "| Com_delete | 26750 || Com_insert | 347420 || Com_select | 1341126 || Com_update | 454425 || Innodb_rows_deleted | 26590 || Innodb_rows_inserted | 347416 || Innodb_rows_read | 2964050 || Innodb_rows_updated | 695605 || Queries | 2304578 || Questions | 2259777 |
However, the obtained values are accumulated. If you want to know the current status, you need to perform a difference calculation. Fortunately, this client tool provides two parameters, in this way, the relevant parameter values of the current database can be obtained in Real Time:
-I, -- sleep = # Execute commands again and again with a sleep between, in seconds
-R, -- relative Show difference between current and previous values when
Used with-I. Currently works only with extended-status.
# mysqladmin -uroot -proot ext -i 1 -r |grep "Questions\|Queries\|Innodb_rows\|Com_select \|Com_insert \|Com_update \|Com_delete "| Com_delete | 26750 || Com_insert | 347420 || Com_select | 1341129 || Com_update | 454425 || Innodb_rows_deleted | 26590 || Innodb_rows_inserted | 347416 || Innodb_rows_read | 2964050 || Innodb_rows_updated | 695605 || Queries | 2304592 || Questions | 2259791 |
In this way, the corresponding value in the current MySQL database per second is obtained, which is intuitive. This command can be used normally on the RHEL 6.4 x86_64 system. However, in The SuSE linux 11sp1 x86_64 system, it is not accurate, that is, use-I (or -- sleep =) to specify the number of seconds to refresh, but this is not the case.
During the test, -- sleep = 1 is often specified, but the result is refreshed about 1 minute or more, which is very strange. However, the reason is found in the use of strace tracking:
# Strace mysqladmin-uroot-proot ext-I 1-r | grep "Questions \ | Queries \ | Innodb_rows \ | Com_select \ | Com_insert \ | Com_update \ | Com_delete" execve ("/ usr/bin/mysqladmin ", ["mysqladmin", "-uroot", "-proot", "ext", "-I", "1", "-r"], [/* 59 vars */]) = 0brk (0) = 0x62a000mmap (NULL, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,-1, 0) = 0x7f0c036fe000access ("/etc/ld. so. preload ", R_ OK) =-1 ENOENT (No such file or directory) open ("/usr/lib64/mysql/tls/x86_64/libmysqlclient. so.15 ", O_RDONLY) =-1 ENOENT (No such file or directory) stat ("/usr/lib64/mysql/tls/x86_64 ", 0x7fffbb00c0f0) =-1 ENOENT (No such file or directory) open ("/usr/lib64/mysql/tls/libmysqlclient. so.15 ", O_RDONLY) =-1 ENOENT (No such file or directory) stat ("/usr/lib64/mysql/tls ", 0x7fffbb00c0f0) =-1 ENOENT (No such file or dire Ctory) open ("/usr/lib64/mysql/x86_64/libmysqlclient. so.15 ", O_RDONLY) =-1 ENOENT (No such file or directory) stat ("/usr/lib64/mysql/x86_64 ", 0x7fffbb00c0f0) =-1 ENOENT (No such file or directory) open ("/usr/lib64/mysql/libmysqlclient. so.15 ", O_RDONLY) = 3 read (3, "\ 177ELF \ 2 \ 1 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 3 \ 0> \ 0 \ 1 \ 0 \ 0 \ 0 \ 0 \ 300 \ 262 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0 "..., 832) = 832 fstat (3, {st_mode = S_IFREG | 0755, st_size = 1420448 ,...}) = 0 mmap (NULL, 3521032, PROT_READ | PROT_EXEC, MAP_PRIVATE | MAP_DENYWRITE, 3, 0) = round (3, 0, 3521032, POSIX_FADV_WILLNEED) = 0 mprotect (0x7f0c032ac000, 2093056, PROT_NONE) = 0 mmap (0x7f0c034ab000, 217088, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_DENYWRITE, 3, 0x126000) = bytes (0x7f0c034e0000, 2568, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,-1, 0) = 0x7f0c034e0000close (3) = 0 ...... <==== Omit a few ====> write (1, "+ -------------------------------"..., 4096) = 4096 write (1, "| 0 "..., 4096) = 4096 write (1, "| \ n | Com_truncate "..., 4096) = 4096 write (1, "ze | 163 "..., 4096) = 4096rt_sigprocmask (SIG_BLOCK, [CHLD], [], 8) = 0rt_sigaction (SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0rt_sigprocmask (SIG_SETMASK, [], NULL, 8) = 0 <span style = "color: # ff0000;"> nanosleep ({83, 0} </span>, | Com_delete | 26750 | Com_insert | 347420 | Com_select | 1341136 | Com_update | 454425 | Innodb_rows_deleted | 26590 | bytes | 347416 | Innodb_rows_read | 2964050 | Innodb_rows_updated | 695605 | | Queries | 2304622 | Questions | 2259821 |The problem is that even if the specified one-second refresh is specified, the system will refresh it once in 83s during the system call:
nanosleep({83, 0}Unfortunately, this function is not used in this system. Unfortunately, all SuSE linux 11sp1 systems in the production environment are depressing ......
I am going to have a chance to ask SUSE about the situation.