FreeBSD mysql and threading

Scott Long scottl at
Sun Dec 5 09:44:15 PST 2004

Dimitry Andric wrote:
> On 2004-12-05 at 17:17:28 alex bustamante wrote:
>>Read somewhere that FreeBSD has some problems with threading and mysql.
>>Has this been fixed in 5.x?
> Somewhere, some problems might sometimes be fixed, so maybe this could
> be the case.  Unless someone gives exact specifications, someone can
> never expect to get exact answers, don't you think? :)

I did some extensive tests with mysql over the late summer to
investigate domain socket performance and test scheduler bugs.  I also
wound up testing threading performance as a consequence.  The result was
that compiling mysqld with the default threading options yields fairly
good results and I could run large stress tests for quite a while
without problems.  The good news is that default option of using KSE
(i.e. libpthread) system scope threads performs about as well as
Linuxthreads, on an SMP system.  Compiling it for KSE process scope
threads should have yielded even better performance, but would up being
barely half.  This could well be due to scheduling bugs since the
results were similar to what I got from using libc_r.

The only stability issues I encountered were from using SCHED_ULE and
PREEMPTION (both together and separately).  I haven't run the tests in
quite a while, so I can't say whether 6-CURRENT behaves any better now
with those options.

As for comparing performance to Linux, it's a lot closer now that it was
in 5.2, but it hasn't quite caught up yet.  There is speculation that
Linux might be cheating with filesystem sync operations on the data
files and thus avoiding a significant amount of overhead at the cost of
safety, but I haven't had a chance to verify this.  But I was still able
to get 11,000-12,000 local queries per second on a reasonable SMP
system, and that's pretty decent.


More information about the freebsd-stable mailing list