25
votes

I know that FreeBSD is famous for being highly stable, secure and of course open source. So I am going to try it on one of my servers. However, I am wondering what are the pros and cons of Using FreeBSD instead of Ubuntu or other Linux flavors? I am specially interested to know about the difference in php/mysql performance between the two, given the hardware is the same and one uses the optimal server configurations.

Thanks

6 Answers 6

38
votes

It is possible to configure Linux behave badly and it certainly is possible to configure FreeBSD behave badly. Both systems can also provide you a stellar performance.

But unless your server is really, really busy you won't see any real-world difference between the two. It is best to use the one you already know and concentrate on fine-tuning the daemons (such as Apache or MySQL) and the applications running on the top of them.

Compiling your own kernel or tinkering with the kernel internal settings starts to matter under a load which nears your hardware limits, whereas creating proper database indexes, caching your web page content, adjusting Apache and PHP settings (or even using lighttpd instead of Apache) and so on helps you right from the start. Even the most "correct" kernel settings won't optimize your page load time noticiably if every page load hits the database or PHP has to render a very complex page.

One area where I definitely would consider FreeBSD is a file-server. FreeBSD has native ZFS support and traditionally it has been a very stable environment for NFS/Samba use.

Also security-wise it's much more likely that someone breaks through your WordPress/Drupal/custom PHP application than by using a OS level security hole.

2
  • Can't thank you enough for a very informative answer. It saved me tens of hours of struggling with the system I don't know much about.
    – Salil
    Jul 17, 2012 at 12:05
  • I'm happy I was able to help you. :) Jul 17, 2012 at 14:36
13
votes

From a technical side we did a lot of research and testing in performance, security and stability. The result was that you can misconfigure every OS to be slow and instable. But based on a standard installation with common tweaks FreeBSD was more stable, secure and performant than any other Linux we tried (RedHat, CentOS and Debian).

From the financial side we found out that the ROI and TCO are a little lower than for Linux systems. FreeBSD is continuously developed and tested very well. Maintenance and upgrades are very smooth and adaptation to own requirements can be easily made thanks to the fabulous ports tree.

For me I would always choose FreeBSD as it is much more fun to work with a consistent system where you know what to do if something goes wrong. For Linux there are too many differences between each distribution which makes research a lot more difficult.

Linux is something you can use for gameservers or embedded systems or as desktop OS. FreeBSD was always meant to be a highly stable server OS and there is almost no OS which can compete.

If you don't know FreeBSD and don't know Linux you should install a common distribution (Debian, Ubuntu or CentOS) and install FreeBSD. If you fall in love with the ports tree and the consistency of FreeBSD, stick with it. If you like the precompiled packages and endless repositories, stick with Linux.

5
votes

There hasn't been any major research done on mysql performance to say the least against linux flavors and FreeBSD. My suggestion would be to set aside a week to do some in depth testing using super-smack and sysbench on your own for your hardware to see which OS gives you more bang for your buck for mysql.

Some annecdotal evidence of linux outperforming BSD in sysbench:

http://www.kernel.org/pub/linux/kernel/people/npiggin/sysbench/ Sysbench mysql performance of linux and freebsd

5
votes

The performance difference is likely to be negligible in practice. FreeBSD has had fairly good multiprocessor support since the 2000s. FreeBSD 7 has SMPng support which has been tested to scale well to at least 8 cores. A technical description can be found here and benchmarks can be found here.

Multiprocessor support on larger machines (say >16 cores) is probably a bit better on Linux but that doesn't affect your particular case.

On a database you're likely to have I/O performance issues long before the efficiency of the kernel makes a noticeable difference. Performance on that sort of server hardware probably won't be materially different. Normally other criteria would be more important in such a decision.

1
vote

The best way to answer question is to load Linux, run some performance tests, and then load FreeBSD and run the same suite of tests. If you get better performance from one or the other, stick with that.

However, I am wondering what are the pros and cons of Using FreeBSD instead of Ubuntu or other Linux flavors?

You're not really going to get a good answer to this question. The truth is that both are fine solutions (both are "highly stable, secure and of course open source") and depending on your personal tastes, hardware configuration, and specific tasks you're trying to accomplish, one may be better than the other.

4
  • larsks, I am hoping that someone already have done such tests. If the difference in performance is negligible, it may not worth going through process of learning FreeBSD.
    – alfish
    Jun 16, 2011 at 3:49
  • I found this benchmark very informative: phoronix.com/…
    – alfish
    Jun 16, 2011 at 3:53
  • 4
    @alfish, Those test are from two years ago, both Linux and FreeBSD have changed (in some areas dramatically) since then. Also, most of software used in the benchmark was written for Linux and modified to work on FreeBSD. Linux "won" most of those. Several of the test where FreeBSD "won" were software written explicitly to the Posix standards (which both are compliant). While these tests might be interesting, they would be more relevant if they used the software you will be using, as it could easily go either way, and there isn't likely to be a large difference.
    – Chris S
    Jun 16, 2011 at 4:53
  • Chris, I thought the tests were OS-agnostic. Thanks for the clarification.
    – alfish
    Jun 16, 2011 at 5:13
0
votes

The best thing you could do is just go with which ever one of the two you are most comfortable supporting. There is very likely to be very little difference in day to day performance/security/scalability as long as you follow the best practices for whatever products you're installing.

Not the answer you're looking for? Browse other questions tagged .