Why is MySQL nearly twice as fast on Linux/AMD64 Vs. FreeBSD/ AMD64?

Haapanen, Tom tomh at waterloo.equitrac.com
Thu May 20 14:40:56 PDT 2004

John-Mark Gurney [mailto:gurney_j at efn.org]:
> Well, there is two parts to SMP, one is the OS seeing the CPU, which is 
> probably happening, since you don't see the idle time drop below 50%...  
> to check how many cpu's FreeBSd sees, run:
> sysctl hw.ncpu
> I get:
> -bash-2.05b$ sysctl hw.ncpu
> hw.ncpu: 2
> On a dual proc box..
> The next part is if the program makes use of either multiple processes, 
> or a threading library like libpthread that will support concurent threads
> of execution...   This last part is the problem you are having...  There
> seems to be a problem with libpthread not starting another kse (iirc) to 
> support the extra cpu...

Right.  Looking at my production server (dual Opteron 242) it looks like I
have essentially been running MySQL on a single CPU, too, based on the ps

root     11     0     0    0 RL    ??  61050:34.15  (idle: cpu1)
root     12     0     0    0 RL    ??  65468:56.13  (idle: cpu0)

The idle time in the ps output should conclusively prove to JG, too, whether
both CPUs are actually being utilized.

It sure doesn't look like the CPU time is evenly distributed across the two
processors -- it looks like MySQL is running on CPU1 only.

I'm happy to provide access to the box if that will help someone figure out
what's going on with the threading.


More information about the freebsd-amd64 mailing list