You are here

Linux system calls of MySQL process

We had the problem today that a MySQL Galera Cluster node with the multi-tenancy pattern caused a lot of system time (sy 75%, load average about 30 (you really must read this article by Brendan Gregg, it is worth it!)) so we wanted to find what system calls are being used to see what could cause this issue (to verify if it is a TOC or a TDC problem:

$ sudo strace -c -p $(pidof -s mysqld) -f -e trace=all
Process 5171 attached with 41 threads
Process 16697 attached
^C
Process 5171 detached
...
Process 5333 detached
Process 16697 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 66.85    1.349700         746      1810           io_getevents
 25.91    0.523055        1298       403       197 futex
  4.45    0.089773        1069        84        22 read
  2.58    0.052000       13000         4         3 restart_syscall
  0.19    0.003802        1901         2           select
  0.01    0.000235           3        69         1 setsockopt
  0.01    0.000210          18        12           getdents
  0.00    0.000078           2        32           write
  0.00    0.000056           1        49           fcntl
  0.00    0.000026           4         6           openat
  0.00    0.000012           2         6           close
  0.00    0.000000           0         2         2 open
  0.00    0.000000           0        22           stat
  0.00    0.000000           0         2           mmap
  0.00    0.000000           0         7           mprotect
  0.00    0.000000           0        16           pread
  0.00    0.000000           0         1           access
  0.00    0.000000           0         1           sched_yield
  0.00    0.000000           0         5           madvise
  0.00    0.000000           0         1           accept
  0.00    0.000000           0         1           getsockname
  0.00    0.000000           0         1           clone
  0.00    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    2.018947                  2537       225 total

$ man io_getevents
...

See also: Configuration of MySQL for Shared Hosting.