Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a web application, that should work with 1000 requests/second using Apache and MySQL. On my server I have Ubuntu installed. Can my application be faster if I install FreeBSD instead of Ubuntu?


share|improve this question

migrated from Nov 11 '11 at 7:52

This question came from our site for professional and enthusiast programmers.

closed as not constructive by Shane Madden, voretaq7, mailq, Scott Pack, Ward Nov 12 '11 at 9:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

in this case doenst' matter the OS but the webserver.. just don't use apache ;) – dynamic Nov 11 '11 at 7:50

The difference between various *nix distros in speed is minimal. I would suggest you use nginx instead of Apache. That might really save your day :)

share|improve this answer
so true, nginx is way better at handling requests – poelinca Nov 11 '11 at 7:55

When optimizing for performance, the selection of OS or Linux flavour matters the least.

  • On the hardware side, your kind of workload probably is happy if the server has plenty of RAM, say 8 or 16 GB. Of course the network connection should be fast, too.

  • First cover your back by making sure you have at least semi-sane settings for your Apache, PHP and MySQL. What are those, that's hard to tell by your two and a half line long question, considering there are books written about this topic. Actually, a separate book for each of the pieces of software above. Also consider replacing Apache with lighttpd or nginx unless you have some specific reason for Apache.

  • Then make sure your application doesn't have typical deadly sins, such as lack of caching, non-optimal or unnecessary SQL queries, fetching some resource from 3rd party server each page load, rendering some thumbnails from an original picture over and over again each page load, lack of SQL indexes, and so on.

  • When you are confident you have everything set up right, benchmark your server with Apache Benchmark, JMeter, Siege or plethora of other available tools. See if your server can handle the load. If not, go back to drawing board and figure out why.

  • Finally, when it comes to OS, it's not about what the OS is (at least when pondering between *BSD/Linux), but how it's tuned. Carefully choose the file system for your use; if you have lots and lots of small files, ext4 might not be the best choice in Linux, for example. On the other hand, the default kernel settings in typical distributions are fine for most workloads, but in more exotic environments things like I/O elevator, shared memory settings, or network parameters might have to be tuned. If you really need to enter this stage, congratulate yourself about a popular service and/or start thinking about getting more servers.

share|improve this answer

As far as your OS is based on Linux/Unix, then no problem.just OS should be TUNED properly and very carefully. the real thing is the performance tuning of Apache and MySQL. and you will surely require a load balancer to entertain 1000 requests/sec. or on the other hand, you can use a very heavy hardware with huge memory and CPU to accommodate everything on same machine. the things you should be concerned is - Careful balancing of Load - Performance tuning of Apache - performance tuning of MySQL (and as well separation of MySQL from Apache server)

share|improve this answer
I've got a server with 2G ram and two old crappy intel processors and I can crank 4000 rps out of it prior to any tuning. It's not that hard to get 1000 rps. Your bandwidth is going to be much bigger factor. Tuning apache would be a waste of time at this scale. – regality Nov 11 '11 at 8:06
regality: Though with poorly written PHP scripts the performance WILL come down a lot. The worst ever PHP application I've seen got 7.5 http requests / sec according to Apache Benchmark. The hardware? Three servers, each with 2 x quad-core Xeons and 16 GB RAM. Luckily after complaining to developer we got the performance much, much, higher. – Janne Pikkarainen Nov 11 '11 at 8:09
@regality: may be you are serving a static HTML page :) but this is what the questioner wants. he need to serve dynamic content, for which 1000rps is HUGE thing. – Farhan Nov 11 '11 at 8:13
@Frank, no, that benchmark is from a php script. Although it does have APC on and that benchmark doesn't include db access. The more important part that I didn't include is that over the LAN it gets around 400 RPS and from the outside world I'm really lucky to see 50 RPS. I was just making the point that you should prioritize bandwidth long long before tuning the OS and apache. – regality Nov 11 '11 at 8:22

First off, BSD is not linux, but that's ok. BSD distros are typically faster than linux, but not enough for you to stress about it. But the fact of the matter is that your operating system is a very small factor in throughput (crappy OSs excepted).

Operating system, web server, database flavor, and programming language will have an insignificant impact on throughput in comparison to hardware. The only notable factor will be the guts in your server. Buy more ram, more cores and faster processors. That will speed things up.

But beyond that, if you are buying your own server, it is probably on your home connection. If you put this on a standard dsl line it is unlikely you could pump out more than 100 RPS. Just be a peach and buy web hosting somewhere that has fast connection to the interblag.

share|improve this answer
While your comment is true at face value, you take BSD and Ubuntu with the exact same ports/packages installed and true enough they'll run pretty damn similar. What makes BSD 'faster' out of the box is what it actually comes installed with, which is basically nothing, at least relative to Ubuntu. FreeBSD is also not for the feint at heart, if you are not an experienced admin then you shouldn't be even contemplating BSD on a production server until you have a solid amount of experience with it. If you think the learning curve is steep with linux it's that again with BSD. – unc0nnected Jul 23 '12 at 15:41

You could also go with ArchLinux, which is about as bare-bones as you can possibly get in a Linux distro.

As other people have already answered, there is typically not really any appreciable difference in speed between distributions; what matters is your configuration and the amount of processes running. That said, Arch is a good choice because you are in control of absolutely everything; you can be sure nothing else will slow down your server without your knowledge.

Besides the distribution, you need to analyze your application flow. Apache has a big footprint and can't serve as many simultaneous connections as some of its single-threaded peers (e.g., nginx, lighttpd), but it is the only good choice for a number of apps. If your pages are well-cached, you're using bytecode optimization, and your query time is low, there's no reason why it couldn't handle 1000 concurrent connections.

But if you're doing any kind of non-trivial processing, you will need to either start thinking about more efficient web servers, or clustering 2 or more Apache servers together in a load-balanced setup.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.