libpthread vs libthread, simply mysql benchmark

Robert Watson rwatson at
Sat Feb 19 05:17:37 PST 2005

In case it's of interest -- I occasionally run MySQL "supersmack" 
benchmarks at work on a dual Xeon box there.  I ran the select benchmark
on the box a few minutes ago, comparing libpthread and David Xu's new
libthread on the box, and the results are pleasing: 

x 6-SMP-HTT-libpthread
+ 6-SMP-HTT-libthread
|  x                                                                  +    |
|  x                                                                  ++   |
|  xxx                                                                +++  |
|xxxxx                                                                +++ +|
| |MA|                                                                |A|  |
    N           Min           Max        Median           Avg        Stddev
x  10       8300.25       8442.54       8379.03      8381.652     39.682672
+  10      10510.35      10646.98      10547.59     10551.599     39.893907
Difference at 95.0% confidence
        2169.95 +/- 37.385
        25.8893% +/- 0.446034%
        (Student's t, pooled s = 39.7884)

In other words, a clear (and healthy) 26% performance improvement on this
simple benchmark.  I don't currently have other numbers to compare
against, such as linuxthreads, etc.

This is a 2.4GHz box with 1gb of memory running MySQL 4.0.23a.  Typically,
I get better performance without hyper-threading turned on, but I can't
get into the BIOS of the box remotely so couldn't turn it off properly.  I
used the latest 6.x SMP kernel combined with the libthread drop from
David's perforce branch.  You can find a URL to his more recent code drops
in the recent threads on freebsd-threads.

FYI, here's a brief history of HTT performance over the past year as 5.x
and 6.x matured:

Version					Transactions/sec
20040515-UP-4BSD			4862
20040515-SMP-4BSD			4620
20040515-SMP-ADMTX-4BSD			4846

20040615-UP-4BSD			4899
20040616-SMP-4BSD			4941
20040616-SMP-ADMTX-4BSD			4979

20040616-netperf-UP-giant-4BSD		4907
20040616-netperf-UP-mpsafe-4BSD		4939
20040616-netperf-SMP-giant-4BSD		4587
20040616-netperf-SMP-mpsafe-4BSD	4609
20040616-netperf-SMP-ADMTX-giant-4BSD	4662
20040616-netperf-SMP-ADMTX-mpsafe-4BSD	6425

20040713-netperf-SMP-ADMTX-mpsafe-4BSD	7063

20040717-netperf-SMP-ADMTX-mpsafe-4BSD	7118

As of today, I get about 8400tps with HTT turned on, probably a bit
betterwith it turned off.  By combining various factors we've introduced
in the last couple of years, such as MPSAFE network stack, scheduling
improvements, threading improvements, mutex changes, etc, we've improved
performance on mysql by over 100% on SMP, going from quite sub-par
performance in the depths of 5.x development (when all the infrastructure
changes were going in but no optimizations) to quite healthy in 6.x,
especially with the new threading library.

Robert N M Watson

More information about the freebsd-performance mailing list