# Matter of Speed: FreeBSD or Linux



## jacktrades (Feb 3, 2012)

Hello,

I have to choose in between FreeBSD and Linux OS. 

It's for a low end current HP or Dell Tower Server (Xeon or I3), that will receive video from the network (IP camera) and will be processed, by a C++ written, OCR (Optical char recognition) software. Speed is significant. The tiny output of the OCR is not signicant.

So, I would guess that FreeBSD would be faster, is this correct?

Thanks!


----------



## jacktrades (Feb 3, 2012)

The Server won't have GUI, just CLI.


----------



## throAU (Feb 3, 2012)

I suspect you'll need to do back to back benchmarking.


----------



## jacktrades (Feb 3, 2012)

OK. But I'm waiting for an advice, so I don't have two do that.


----------



## drhowarddrfine (Feb 3, 2012)

FreeBSD can run many Linux applications faster than Linux can so choose FreeBSD. Someone else will recall the reason for that.


----------



## estrabd (Feb 3, 2012)

Pathscale released their C++ runtime under BSD not too long ago. There is also a lot more interest in many-core and SMP performance in BSD, and this might be attractive to your application needs.


----------



## DungeonMaster3000 (Feb 3, 2012)

My expierence with straight out processing - FreeBSD is faster than Linux... Linux distos have larger communities BUT in my very opinionated replyâ€¦ Go FreeBSD (from a reformed OpenBSD user)


----------



## jacktrades (Feb 3, 2012)

estrabd said:
			
		

> Pathscale released their C++ runtime under BSD not too long ago. There is also a lot more interest in many-core and SMP performance in BSD, and this might be attractive to your application needs.



That software is very expensive...


----------



## overmind (Feb 3, 2012)

Also you should also keep in mind other parameters to the equation: security (is the box available on the internet) and stability. FreeBSD is more stable and more secure. You don't need that video box to crash.


----------



## nakal (Feb 3, 2012)

> So, I would guess that FreeBSD would be faster, is this correct?



I don't think so, but it's worth to compare and post results.


----------



## throAU (Feb 3, 2012)

You won't get a useful answer without

a.  finding someone who is running (or has run) the exact same work load on both OSes on the same hardware

or

b.  benchmarking it yourself in test.  work out your application's bottleneck(s) and test both platforms for it on your hardware before making the choice.

However, comparing on performance out of the box only is only somewhat useful.  Both platforms can be tuned, both platforms will no doubt have hardware and workloads that they are best at, and both platforms running on appropriate hardware are likely to be plenty fast enough.  I suspect competence of your admin will have more of an effect on performance than the OS of choice.

FreeBSD can run SOME Linux applications faster than Linux, but this was measured years ago (back in the Linux kernel 2.0 days - may or may not hold true today, and can't run 64 bit Linux apps), and isn't true for all applications in any case.

Additionally, some commercial applications are only supported on Linux.


Work out what your requirements are, do a pro/con on both options and make your choice.  I suspect performance difference when both are configured properly will be negligible (also, FreeBSD has traditionally been more responsive under load which may or may not be important to your application); the more important differentiators are how good your admin is (if you have a Linux-only admin available he'll be crap at FreeBSD and vice versa), what level of commercial application support you need, what hardware support you need and whether or not there are any other features available in one OS but not the other that are of importance to you (e.g., DTrace, ZFS, Beowulf clustering, etc).

I've run both Linux and FreeBSD over the years, and prefer BSD due to the more stable user land (in terms of breaking compatibility), better response under load and being more true to the "unix way" of doing things.

But... I have a couple of RHEL boxes at work (barf).  Why?  Because our application is only supported on Solaris, SCO or RHEL.


----------



## drhowarddrfine (Feb 3, 2012)

Article from last year comparing gaming on  PC-BSD to Ubuntu. FreeBSD is faster.


----------



## throAU (Feb 3, 2012)

drhowarddrfine said:
			
		

> Article from last year comparing gaming on  PC-BSD to Ubuntu. FreeBSD is faster.



Faster at those particular benchmarks perhaps.

However, whether or not those are representative of the workload being considered here is another thing entirely.

I'm not saying Linux is necessarily faster.  I'm saying that unless you benchmark YOUR workload, you have no idea.


----------



## foxconn (Feb 3, 2012)

From my own limited experience, if it's speed you're after, you truly owe it to yourself to try building a lean and mean linux system with the Gentoo/Arch linux distro. For general desktop use, they're at least just as fast as FreeBSD with self recompiled kernels and "new world" and you're more likely to be able to find the "tools" you need for your particular application there as well. Having said that, I, like many here, still love my FreeBSD system X)


----------



## UNIXgod (Feb 3, 2012)

The old benches where based on video acceleration under the linux emulator on FreeBSD being faster than linux itself. As it's been mentioned that bench is over a decade old.

Both Arch and Gentoo will be administrative nightmares and will probably give very little speed over FreeBSD. In fact Gentoo was always known for speed because of the use of a beta gcc with experimental optimization flags. Their official documentation suggests against the practice nowadays. For a hobby laptop those linux distros are fine. For a production server you'll want to stick with FreeBSD for stability and security. FreeBSD can be tweaked per application and usage. You'll still be left to the task of optimizing it and benchmarking it if what your looking for is raw speed.


----------



## estrabd (Feb 3, 2012)

jacktrades said:
			
		

> That software is very expensive...



It's based on AMD's *free* Open64 compiler. The primary difference is that it has a proprietary OpenMP runtime. In general, though, they follow the Open64 trunk. So, you may want to look into that.


----------



## NewGuy (Feb 3, 2012)

*Benchmark*



			
				drhowarddrfine said:
			
		

> Article from last year comparing gaming on  PC-BSD to Ubuntu. FreeBSD is faster.



The "benchmark" mentioned in the linked article pits Ubuntu running Gnome against PC-BSD running KDE on two different machines with different specs. That's not a benchmark. That's a fluff piece.

In response to the original question, there really isn't any honest way to say which one is faster or better or more compatible with what you want based on the information provided. As someone else pointed out, if the project is of importance you'll take a few days to test both systems yourself and choose the one which best suits your needs.


----------



## Terry_Kennedy (Feb 5, 2012)

NewGuy said:
			
		

> In response to the original question, there really isn't any honest way to say which one is faster or better or more compatible with what you want based on the information provided. As someone else pointed out, if the project is of importance you'll take a few days to test both systems yourself and choose the one which best suits your needs.


For an application that spends almost all of its time in its own code, rather than making system calls or using library routines, the only large differences you're going to see will likely be due to different compilers generating better or worse code. If you want to eliminate the compiler variable when benchmarking, try using the Linux binary under FreeBSD emulation.

If your application is the only one running on the system, scheduler overhead should be trivial ("nothing else needing to be scheduled" is a best case for schedulers and has likely been highly optimized under both operating systems). If the application is multi-threaded, the scheduler and/or thread dispatching routines (I believe FreeBSD and Linux use very different thread models) may have a larger impact.

Most of the "X is a lot faster than Y" reports are due to measuring system calls or library routines. As an example, I remember some software (MySQL) that behaved very differently on FreeBSD vs. Linux. As I recall, MySQL makes (made?) an unreasonable number of gettimeofday() calls, which were a lot slower on FreeBSD. There are also cases where one OS can make use of some hardware features and the other OS can't. This would be things such as video card acceleration, TCP offload in network cards, and so on.


----------



## shitson (Feb 5, 2012)

throAU said:
			
		

> You won't get a useful answer without
> 
> a.  finding someone who is running (or has run) the exact same work load on both OSes on the same hardware
> 
> ...



Agree++ ^

I think all need to read the above post, if you straight out say that FreeBSD > Linux you really need to back that up with some good old fashion evidence (hopefully some that proves that OPs **custom** application runs faster)

The OP really needs to do some in house testing on his _custom_ application and not rely on anecdotal evidence of performance. It really confuses me when people say ** speed critical ** or ** mission critical ** but double take like OP has when you say how about testing? It's almost like an oxymoron how the OP has described his problem... It needs to be fast, but i don't want to have to test it. 

I love my FreeBSD as much as the next person in this thread, but blind and incorrect advocacy of FreeBSD's performance is a slippery slope to fanboyism. 

To the _OP_ you need to test your application on both FreeBSD/Linux and compare performance using some type of meaningful metric. Both of the OSes are free and effort is the only price you need to invest. It would be nice if you came back with the information on setup & performance results.


----------



## throAU (Feb 6, 2012)

Terry_Kennedy said:
			
		

> For an application that spends almost all of its time in its own code, rather than making system calls or using library routines, the only large differences you're going to see will likely be due to different compilers generating better or worse code.



Well, not necessarily.  I mean, what you say is true, sure... but in the real world, any high throughput app is going to need to do IO and allocate memory.  

Any time the app writes to disk, allocates/frees memory, or touches the network, uses a camera driver, etc, it will be hitting the kernel.

Something as mundane as a network driver issue, the way the custom application allocates memory, or filesystem choice/tuning issue (as per recent phoronix benchmarks) on either OS for this guy's particular hardware build could skew the statistics way off in one direction or another.

We can speculate on how the workload will perform on either OS until the cows come home, and even run our own tests - until this guy does back to back testing on *his *hardware all results need to be taken with a good handful of salt.

As shitson stated - if the throughput is important, spending a couple of days/weeks installing and tweaking both free platforms is time well spent to confirm any suspicions you may have regarding performance.


----------

