Why is MySQL nearly twice as fast on Linux?

Robert Watson rwatson at freebsd.org
Sun May 23 22:16:12 PDT 2004

On Sun, 23 May 2004, Petri Helenius wrote:

> I find it hard to believe that the threading stuff would be seriously
> broken since we do large processing with libkse and don´t have issues
> with the performance. However I´m observing about 50000 context switches
> but only 5000 syscalls a second. (I know it´s a different application
> but also for 1500 queries a second 70000 syscalls sounds excessive). 

Another thing that would be interesting to know is where the user
processes are doing most of their waiting.  Unfortunately, the mechanism
I would use to derive this is a bit complicated.  Not sure if you want to
get into it or not, but... here's what I would do:

I'd modify the KTR(4) tracing in msleep() to track the time slept and
generate a log message indicating the wait channel, wait time, and process

I'd set up a KTR and maybe ALQ trace to log a set of MySQL traces over a
five second window during the benchmark.

I'd dump the log records and then do a bit of statistical analysis to look
at what the wait time distribution for various wait channels is.  This
might give a hint as to what in the kernel is being "waited" for.  A nice
pretty graph or the like for each wait channel.

My recollection of previous posts in this thread is that the system is
relatively idle, but did we determine what behavior was being seen on UP
relating to CPU consumption?  In particular, % user/system/interrupt/... 
time for the CPU during a sustained benchmark run?

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research

More information about the freebsd-threads mailing list