FreeBSD MySQL still WAY slower than Linux

Steve Roome steve at lonres.com
Fri Jun 10 17:05:40 GMT 2005


We're using mostly:

  5.4-STABLE FreeBSD 5.4-STABLE #0: Mon Jun 6 12:22:18 BST 2005

This is on a Dell PowerEdge 2850. (2 * 2.8 GHz Xeons, 4GB ram, disks),
we've been keeping up with stable because supposedly all these new
fixes to threading will help us out here.

We're trying to get FreeBSD to perform reasonably well, in comparison
to Linux, or even what we should expect to see. We're getting about
half the performance we get from gentoo on the same application
(mysql).

The discussion on the 'freebsd-threads' mailing list about a year ago 
seems to match our experiences nowadays pretty well:

	http://lists.freebsd.org/pipermail/freebsd-threads/2004-May/002002.html

Nothing much seems to have changed, although lots of people claim that
FreeBSD 5.x is now fine, it doesn't seem to be.

Here's a rough breakdown of the sort of performance we're seeing, this
is the default select-key super-smack but setup for innodb rather than
myisam.

> Using the simple 'select-key.smack' Super-Smack benchmark (50 clients 
> with 1000 runs each):
> 
> OS          CPUs    Build       Threading        Kqueries/sec
> -------------------------------------------------------------
> FreeBSD      1      Pro         KSE                  10.6
> FreeBSD      1      Pro         libthr               10.6
> FreeBSD      2      Pro         libthr               14.4
> FreeBSD      2      Source      libthr               14.5
> FreeBSD      2      Source      KSE/P (static)       15.7
> FreeBSD      2      Source      KSE/P (dynamic)      15.8
> FreeBSD      2      Source      KSE/S (dynamic)      15.8
> FreeBSD      2      Pro         KSE                  15.9
> FreeBSD      2      Source      LinuxThreads         17.7
> Gentoo       2      Source      NPTL                 34.0  !!
> 
> (KSE/P = KSE with Process Scope Threading, KSE/S = KSE with System 
> Scope Threading)

And, here's the full set of results :

> # FreeBSD 5.4-STABLE SMP, MySQL Pro 4.1.12, libkse
> gid at lithium 27 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  2       0       15978.35
> select_index    100000  3       0       15908.00
> select_index    100000  6       0       15852.89
> select_index    100000  6       0       15888.05
> select_index    100000  5       0       15868.09
> 
> # FreeBSD 5.4-STABLE NON-SMP, MySQL Pro 4.1.12, libkse
> gid at lithium 9 0 %  foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  11      0       11846.17
> select_index    100000  7       0       10544.36
> select_index    100000  4       0       10615.13
> select_index    100000  5       0       10607.55
> select_index    100000  4       0       10640.58
> 
> # FreeBSD 5.4-STABLE SMP, MySQL Pro 4.1.12, libthr
> gid at lithium 33 130 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> Select_index    100000  19      3       14412.10
> select_index    100000  11      3       14529.83
> select_index    100000  11      3       14489.03
> select_index    100000  12      3       14488.09
> select_index    100000  15      3       14495.77
> 
> # FreeBSD 5.4-STABLE NON-SMP, MySQL Pro 4.1.12, libthr
> gid at lithium 11 0 %  foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  7       0       10531.75
> select_index    100000  5       0       10673.64
> select_index    100000  24      2       11179.66
> select_index    100000  28      4       10675.24
> select_index    100000  27      4       10191.25
> 
> # FreeBSD 5.4-STABLE SMP, Hand-built 4.1.12, libthr (dynamic)
> gid at lithium 4 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  13      3       14487.99
> select_index    100000  16      3       14460.64
> select_index    100000  11      3       14397.79
> select_index    100000  15      3       14503.39
> select_index    100000  11      3       14502.58
> 
> # FreeBSD 5.4-STABLE SMP, Hand-built 4.1.12, libkse process scope (dynamic)
> gid at lithium 7 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  16      2       15813.88
> select_index    100000  14      1       15901.01
> select_index    100000  3       0       15870.71
> select_index    100000  14      0       15917.34
> select_index    100000  6       0       15357.74
> 
> # FreeBSD 5.4-STABLE SMP, Hand-built 4.1.12, libkse process scope (static)
> gid at lithium 7 130 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  19      3       15836.35
> select_index    100000  22      2       15807.58
> select_index    100000  20      3       15782.74
> select_index    100000  21      3       15790.82
> select_index    100000  21      3       15724.96
> 
> # FreeBSD 5.4-STABLE SMP, Hand-built 4.1.12, libkse system scope (dynamic)
> gid at lithium 7 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  22      0       15792.41
> select_index    100000  8       0       15718.67
> select_index    100000  4       0       15837.49
> select_index    100000  5       0       15834.15
> select_index    100000  3       0       15892.31
> 
> # FreeBSD 5.4-STABLE SMP, Hand-built 4.1.12, LinuxThreads
> gid at lithium 3 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  2       0       17709.35
> select_index    100000  2       0       17701.14
> select_index    100000  1       0       17758.04
> select_index    100000  1       0       17829.17
> select_index    100000  9       0       17557.00
> 
> # Gentoo Linux 2005.0, Hand-built 4.1.12, NPTL
> gid at unoctunium 1 0 % foreach f (1 2 3 4 5) {/data/supersmack-1.3/bin/super-smack select-key.smack 50 1000|grep select_index}
> select_index    100000  0       0       34420.06
> select_index    100000  2       0       34034.52
> select_index    100000  4       0       33236.42
> select_index    100000  3       0       33210.14
> select_index    100000  1       0       34610.75


Thanks in advance for anyone that has a clue on this, and has anyone
figured out why FreeBSD is just so amazingly slow compared to Linux.

(That's not meant as flamebait, it just is.)

        Steve Roome


More information about the freebsd-stable mailing list