FreeBSD advantages over Linux

FreeBSD Unix is the unsung hero of technology.

The rise of Apple, Mac OS X, and iOS are thanks to it, and based on it. The most reliable routers in the world, those made by Juniper, are powered by it. The PlayStation 4 operating system is based on it. Heck, the girl in the news who seemingly broke #GamerGate even named herself after it. And yet, the mighty FreeBSD, a pure UNIX variant, is very much under the radar and hardly discussed.

FreeBSD powers under 1% of websites these days, but it powers over one-third (33%) of web traffic. The sites run on FreeBSD are many of the most powerful and robust. Netflix, which streams the most content over the Internet by far, does it all on FreeBSD. Yahoo and its large network of sites, like Flickr, run entirely on FreeBSD. IBM works extensively in FreeBSD these days. And Facebook may run on Linux, but wants to hire people to make Linux almost as good as FreeBSD. That’s right. Facebook wants to pay hundreds of thousands or millions of dollars in hopes that Linux can just start to “rival” the performance of FreeBSD!

And good luck to Facebook there, because the two largest contributors to FreeBSD code are Juniper Networks and Netflix. One makes the best performing “big iron” network routers in the world, and the other serves such a huge portion of the world’s Internet streaming.

So why haven’t you heard much about FreeBSD? Because people like to go with a “gorilla”, a known entity, without worry about the competition. You can see this in many markets. Sometimes it is warranted — I think there are good reasons why iPhone is ahead of Android at the high-end of the phone market, or why Intel is above AMD at the high-end of the CPU race — but sometimes perceptions of market leadership and innovation don’t fit reality. This is one of those cases.

A little history is probably needed upfront. Where did these two operating systems come from? Unix was first developed at Bell Labs and parent AT&T starting in 1969. The key to everything after happened in 1973 when Unix was the first OS to be re-written in C rather than assembly code, making it freely portable between different hardware. It also was freely licensed to anyone who asked, as AT&T was barred from selling products in the computer industry due to an anti-trust lawsuit. Unix, free and portable, fast became the de facto research OS at many companies and especially academic institutions.

One of those academic institutions was the University of California at Berkeley. The distributions of Unix from Bell Labs included the source code, allowing users to freely alter and modify Unix to their tastes. Berkeley Unix became known by 1977 as the top performing version of the OS, and so in that year Bill Joy began compiling the first BSD. The first version of BSD, 1.0, was released in March 1978.

Long story short, AT&T spun off Bell Labs in 1984, and it was no longer required to freely distribute Unix. By that time, BSD performed much better than standard Unix and was still free, so Bell Labs tried to combat this by collaborating with IBM and HP to release System V. It became the basis of Sun Solaris, HP-UX, and IBM AIX, but was expensive and didn’t match the performance profile of still-free BSD. Legal battles ensued, as Bell, IBM, and HP were rapidly losing sales to the freely distributed BSD.

During this legal trouble, Linus Torvalds decided to write a Unix-like OS from scratch that wouldn’t have the legal troubles of a Unix variant like BSD. So he did, and it was released in 1991. Programmers clamored over it, as BSD was held up in court and no longer freely available. By the time legal battles were over and “FreeBSD” was released in 1993, Linux already had a two-year first-mover advantage at its back and hasn’t looked back. Linux had filled up the giant void left by a freely distributed BSD while it was held up in court for so long.

But while Linux is free, it is no BSD.

Now, before I give you several FreeBSD advantages over Linux, know that Linux too has one big advantage. That is that whereas FreeBSD has Netflix and Juniper continually improving its world-beating network performance, Linux has Intel continually improving its hardware performance. So if you are building a supercomputer that is going to be crunching impossibly large numbers and not connected to the Internet, I’d be the first to recommend you use Linux and not FreeBSD.

But as a web server, Linux just can’t handle the high loads that FreeBSD can, and that’s because its network stack, maybe the most important aspect of any modern server OS, is inferior to FreeBSD.

If you’re running a server that has static HTML 5 + CSS 3 files being sent to the Internet, you are going to be best served by FreeBSD. Where it gets more complex is when you are, say, running WordPress as this site is, and then there is a lot of PHP and MySQL going on. Linux can crunch those faster than FreeBSD can, but then it all has to be served to the Internet, bringing some advantage back to FreeBSD to mitigate the difference.

The secret sauce is that deploying a caching system to WordPress turns those PHP files back into static content, and makes FreeBSD much faster and resilient to more traffic spikes than Linux again. Therein lies the prime advantage of FreeBSD over Linux that has had staying power. In 1999, at the height of the Linux craze, people were saying “wait a minute, but the network stack of FreeBSD is so much better.” And here we are 16 years later, and the story remains the same.

This is always going to be the first advantage of FreeBSD.

Advantage #1: the network stack of FreeBSD is superior to Linux.
They don’t call FreeBSD the operating system with “the power to serve” for nothing. It’s the premier server OS. Both Juniper and Netflix contribute to FreeBSD with a goal of “zero delta” from base FreeBSD, in other words nearly every tweak they make to the FreeBSD networking stack makes it into the open source project for us all to use.

These two organizations hire many of the the top networking and world wide web experts on Earth, and we all benefit from their genius when using FreeBSD. Facebook may be trying to change Linux for the better, but there’s really not a lot they can do to make Linux compete.

FreeBSD is a superior web server, and it improves more rapidly.

Advantage #2: The ZFS file system of FreeBSD is superior to Linux.
ZFS is both the most secure and fastest file system in existence. Most people even in the Linux community agree on this. Unfortunately, the license of ZFS is not compatible with the GNU licensing of Linux. It’s not even compatible with the licensing philosophy of Calgary, Alberta based OpenBSD, which is another reason, in addition to Advantage #1, why I am an advocate of FreeBSD and not just BSD in general. The only other major operating systems to use ZFS are Mac OS X (based on FreeBSD) and Sun Solaris (from which it came).

All else being equal, you’ll experience less data loss with FreeBSD.

Advantage #3: FreeBSD is developed as an integrated operating system.
Linux is a kernel. Debian or Red Hat, etc., is the accompanying OS.

With FreeBSD, it’s different.

The FreeBSD kernel is developed as part of a coherent, fully integrated operating system. The difference can be compared to that between iPhone and Android. When you buy an iPhone, you are getting the OS and in that case even the hardware, exactly as it was intended. There is no Samsung or HTC fiddling with the OS to put their own take on it. Likewise, with FreeBSD you are getting the pure and true version, not the result of Fedora or Ubuntu, etc., fiddling with everything outside of the kernel.

/——/

So there you go, three very important advantages of FreeBSD versus Linux. It’s heartening that, in the past year, each of Vultr, Digital Ocean, and Atlantic.net all have started offering FreeBSD as a pre-installed VPS option. See the Digital Ocean and Atlantic.net press releases here and here. Vultr offered FreeBSD from the beginning. Competition is good!

Remember, most people know that there are different flavors of Linux but as per #3 above, they’re all based on the same Linux kernel in the end. That’s not only boring, but non-performant. So if you really want blistering yet secure Internet performance, give FreeBSD (and Nginx too, but let’s save that for later) a shot.

BOTTOM LINE: There’s room for two open source kernels in the world! Especially since the lesser known one is usually better for servers.

Ben Lunsford, February 2015.