Last September, I wrote entry that became quite popular. In FreeBSD or Linux for your MySQL Server? I detailed some of the reasons that led me to recommend Linux over FreeBSD for MySQL servers at Yahoo. You may have also noticed my Solved: MySQL, FreeBSD, and LinuxThreads post back in October. Many people have e-mailed me recently to ask if the old posting is still accurate. A lot has changed since then and I'm writing this as a brief follow-up.
MySQL now runs very well on FreeBSD. I'm no longer steering people toward Linux. There are two important things you should do to make the FreeBSD/MySQL combo work well: (1) build MySQL with LinuxThreads rather than FreeBSD's native threads, and (2) use MySQL 4.x or newer. For more details, keep reading.
By building MySQL with LinuxThreads support (easy to do with the mysql40-server from the ports collection), you'll end up with a recent version of MySQL that doesn't suffer from any of the problems I described in my previous notes.
Many months back, one of Yahoo's uber-hackers contacted me to volunteer his time toward making MySQL run as well on FreeBSD as it does on Linux. After a few weeks time of tracking down a few bugs, we reached that goal.
The problem of MySQL threads not "noticing" that they were killed turned out to be bug in the FreeBSD kernel. That bug has been patched in FreeBSD 5.0. There's a work-around in the MySQL 4.0 source and beyond. It was never back-ported to 3.23, but it wouldn't be hard. Simply look for "Yahoo!" in the vio/vio.c file of MySQL's source tree to see what was necessary. I think the same bug was responsible for the wait_timeout not working correctly when using LinuxThreads.
The problem of MySQL occasionally thinking that all databases had vanished resulted from FreeBSD's non-threadsafe implementation of realpath(). The solution, as mentioned earlier, is to compile MySQL with the -DHAVE_BROKEN_REALPATH option. MySQL's configure script has been updated to do that automatically on FreeBSD systems. And a new implementation of realpath() was recently committed to FreeBSD's CVS repository.
Posted by jzawodn at May 03, 2003 10:19 PM