On a FreeBSD system, in the top output below, the mysql daemon is in state "sbwait". What does this imply?
last pid: 12833; load averages: 0.18, 0.26, 0.25 up 3+17:40:21 04:58:46
26 processes: 1 running, 25 sleeping
CPU: 16.5% user, 0.0% nice, 12.8% system, 6.8% interrupt, 63.9% idle
Mem: 184M Active, 137M Inact, 88M Wired, 6308K Cache, 53M Buf, 7192K Free
Swap: 4096M Total, 420K Used, 4095M Free
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
1772 mysql 17 30 0 224M 165M sbwait 511:31 14.79% mysqld
12833 root 1 20 0 9944K 1488K RUN 0:00 0.10% top
1472 root 1 20 0 9612K 828K select 5:07 0.00% powerd
1465 root 1 20 0 11296K 1644K select 2:01 0.00% ntpd
1804 root 1 20 0 11324K 2140K select 0:37 0.00% sendmail
1403 root 1 20 0 12200K 2320K select 0:27 0.00% nmbd
1814 root 1 20 0 9644K 1004K nanslp 0:08 0.00% cron
1407 root 1 20 0 20756K 3756K select 0:06 0.00% smbd
1273 root 1 20 0 9612K 1036K select 0:04 0.00% syslogd
11937 root 1 20 0 15788K 3124K select 0:03 0.00% sshd
1808 smmsp 1 20 0 11324K 1864K pause 0:01 0.00% sendmail
1438 root 1 20 0 20840K 3696K select 0:00 0.00% smbd
1111 _dhcp 1 20 0 9540K 1136K select 0:00 0.00% dhclient
11941 root 1 20 0 10940K 2024K pause 0:00 0.00% csh
1517 mysql 1 52 0 9924K 1072K wait 0:00 0.00% sh
1073 root 1 47 0 9540K 1012K select 0:00 0.00% dhclient
1797 root 1 20 0 13064K 1892K select 0:00 0.00% sshd
It means that one of the threads in the process in the process is waiting for data to arrive on a socket. The default mode of top is not very informative for a threaded process like mysqld; while you have 17 mysql threads, top can only show you one of them in this mode. You should use the '-H' flag to top (or the 'H' keyboard command while in top) to see the individual threads separately, which will show each thread's distinct status.
Use the source:
find /usr/src -type f -exec grep -H sbwait {} \+
That will give you some files to look at.
Look at /usr/src/sys/kern/uipc_sockbuf.c
:
/*
* Wait for data to arrive at/drain from a socket buffer.
*/
int
sbwait(struct sockbuf *sb)
{
SOCKBUF_LOCK_ASSERT(sb);
sb->sb_flags |= SB_WAIT;
return (msleep(&sb->sb_cc, &sb->sb_mtx,
(sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwait",
sb->sb_timeo));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With