# FreeBSD vs Linux performance for PHP/MySQL servers?



## Bolek (Sep 1, 2013)

Hi FreeBSD community,

I am a pure Linux user/admin who is very curious to get to know and possibly migrate to FreeBSD. Currently I'm reading this amazing 'Absolute FreeBSD, v.2' book to get acquainted with. However since as a an admin of some busy sites, the performance is my primary concern,  there are points that I'd like to clarify before using FreeBSD in production. Hope you can help me. 

I have searched a lot but found almost no real-world comparisons of Linux vs FreeBSD especially when it comes to PHP/MySQL performance on SSD disks and high-end multi-processors.  

Any real world experience/benchmarks/anecdotal tales are welcome. 

Thank you.


----------



## sossego (Sep 1, 2013)

As with any Linux distribution, the performance is based upon hardware, configurations, familiarity, and previous experience.


----------



## ziyanm (Sep 1, 2013)

There's some anecdotal evidence here: http://nileshgr.com/2013/06/07/the-move-from-linux-to-freebsd. As always, YMMV.

To most "switchers" the compelling reasons are features like ZFS, jails, nicer firewall (PF), DTrace etc.


----------



## ShelLuser (Sep 1, 2013)

Bolek said:
			
		

> However since as a an admin of some busy sites, the performance is my primary concern, there are points that I'd like to clarify before using FreeBSD in production. Hope you can help me.


No offense intended but I think you might have your priorities mixed up. Sure, I can see that performance can be an important issue, but I don't see how that would justify doing something as drastic as switching operating systems.

You see; there are several differences between Linux and FreeBSD where the most obvious one is the way in which software gets installed. Linux distributions usually rely on binary packages whereas FreeBSD relies on the so called 'ports collection', which is basically a means to obtain the original source code and compile that to build a working binary.

So the difference which would most likely affect you is the way the software you're currently using gets build.

But the thing is; you don't need FreeBSD for that. Every mature Linux distribution out there (here's looking at Debian, CentOS, Fedora, even SuSE) provides options to obtain source packages. Better yet; will also provide the tools required to (relatively) easy build your own customized packages.

Another thing to keep in mind; although it's quite likely that you'll gain some extra performance by building your own packages (mostly due to using optimized and/or specific build options) it will most likely not be as spectacular as I assume you think it is.

If your only motivation to look into FreeBSD is performance then I'd stop while you're ahead. You may find some, but I sincerely doubt that the possibly available gain is worth the tremendous effort that would go into switching operating systems.

Better motivations for switching, in my opinion of course, would be the way the system is being managed, the lower risk factor while applying updates due to FreeBSD having split the base system (kernel and the likes) from the "third party software" (ports collection), the (IMO _much_) better ways in which you can secure your system out of the box, and of course it's documentation.

But I honestly think that if you're only focused on performance you may end up disappointed.


----------



## andyzammy (Sep 1, 2013)

ziyanm said:
			
		

> There's some anecdotal evidence here: http://nileshgr.com/2013/06/07/the-move-from-linux-to-freebsd. As always, YMMV.
> 
> To most "switchers" the compelling reasons are features like ZFS, jails, nicer firewall (PF), DTrace etc.



Interesting read. That article mentioned using a hard drive and a memory stick as a tape drive, in order to transfer data between FreeBSD and Linux. Please could someone tell me how this is achieved? I.e., is a raw tarball being written to the drives without an underlying filesystem?

Sorry for the offtopic.


----------



## ShelLuser (Sep 1, 2013)

andyzammy said:
			
		

> Please could someone tell me how this is achieved? I.e., is a raw tarball being written to the drives without an underlying filesystem?


Simple; instead of a file specify a raw device.

For example, on Linux I could use `# tar cvf /dev/sdb --format=posix /home` to backup /home directly onto /dev/sdb (where I'd use format to make sure FreeBSD can read it too). Be very careful with stunts like that because it will effectively destroy anything which might be on the target device (hard disk).


----------



## andyzammy (Sep 1, 2013)

ShelLuser said:
			
		

> Simple; instead of a file specify a raw device.
> 
> For example, on Linux I could use `# tar cvf /dev/sdb --format=posix /home` to backup /home directly onto /dev/sdb (where I'd use format to make sure FreeBSD can read it too). Be very careful with stunts like that because it will effectively destroy anything which might be on the target device (hard disk).



Now that's just too simple! It's effectively like a dd then? Thanks for that 

To chip in to the discussion, the only way to know for sure is to put two servers next to each other and compare the performance. What might work for someone else might not work for you.


----------

