I'm new to Linux world and I'm learning as much as i can.

There is a server application that needs to deal with huge number of requests per second. The server has been written for Linux using C++. We need to deploy in this server on a free OS that gives us the best performance possible. If you were to decide, which OS would you choose?

migrated from stackoverflow.com Oct 4 '09 at 6:13

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

  • 2
    Exactly what does huge mean? 1000 ? 10000? 10000? – Robert Munteanu Oct 4 '09 at 6:56

I dont think your question is very clear. Linux IS the OS. the distribution is what packages Linux and other software up into a nice bundle for you to install and run.

that said, the main contenders for Linux servers are:

  • RedHat / CentOS
  • Debian
  • Ubuntu Server?

between distributions, there's very little difference between the major versions of software, except perhaps the kernel. (I know CentOS is still running 2.6.18.) my personal vote is for Debian Stable, but distro choice is a very personal thing. spend some time on Wikipedia and Google, as well as the various distro websites before you make a decision. and feel free to ask questions!

  • Linux IS NOT the OS, Linux is the kernel. The kernel is only one part of the OS. Quite a big one, but only a part nonetheless. – kyrias Nov 5 '12 at 0:26

All of the modern distributions will give you pretty much the same performance as they will be based on the same kernel (Linux 2.6.x).

I recommend Ubuntu Server Edition, it is user friendly and easy to get up and running.


It all depends on how the app is coded, what it does and so on. Recent Linux versions have included new APIs to boost high throughput, such as splice/vmsplice, introduced in 2.6.17. But it obviously requires your app to be use them. All recent versions of modern distros will have at least that kernel anyway.

Splice basically allows you to pass data between file descriptors without copying it. You just tell the OS, take that many bytes from there and send them there. It reduces data copying and context switching since it all gets done in kernel.

Applications such as haproxy can use this call to fill up a dual 10 gigabit ethernet card on a low end server.

Now splice/vmsplice/tee are not going to make much difference if your app is not spending most of its time copying data around. But there are other syscalls you want to investigate to handle lots of simultaneous connecitons.

For instance make sure you use epoll instead of select/poll. Where the latter send a list of all the FDs they're interested in at every call, epoll_create builds a list in the kernel, and the epol_wait call just references that list. You can see the advantage when you're listening to thousands of sockets, and you call select/poll ten thousand times a second.

Beyond that you want to look at run-time sysctl settings. The defaults are usually way too conservative.

Finally, I would definitely recommend you use a subscription/support-based distro such as RHEL or SLES; the kind of support service they provide is exactly what you need, in that they will help you if there's a performance regression in the kernel, and they will be able to get the fix quickly in.

  • Your answer is very interesting. Can you give me a ling to a sample code that uses epoll? – redclover Oct 4 '09 at 16:52
  • err man epoll says it all haproxy uses it, you can look at that – niXar Oct 4 '09 at 17:43

You need to benchmark your specific application on various distros. Any answer you get on StackOverflow given only the information you provided would be pure speculation. When high performance is essential, there is no substitute for benchmarks.


I'd say that you target a kernel release rather than a specific OS. On top of that, you should really look into tuning the network layer, it can make a huge difference.


Honestly, I would recommend Arch Linux. For a server, it is quite easy to set up. It is i686 or amd64 optimized, so very fast. Pacman is good for updates.

I've had no problems with its stability either.


I think what's more important is finding out which distribution will give you the best rights to distribute your server software even further! Since your server is running C++ code, you're probably distributing your own code as binaries only. This might or might not be possible with certain distributions. Worse, you might have been using certain GPL libraries within your code which will cause your code to "inherit" the GPL license. I'm not sure if you're willing to publish your code as open-source, though.

Still, if your code only relies on the Linux kernel then all you have to do is to create your own distribution based on this kernel plus your own code. Using an existing distribution could make the whole licensing part a huge licensing nightmare.


Most linuxes provide you pre-compiled software.

If performance is your goal, try Gentoo: all packages and the kernel itself is compiled on your hardware, and optimized to work better on it. This gives some performance boost :)


I agree with some of the answers posted before, if we're talking performance your problem is not the distro (redhat vs. ubuntu vs. ....). I use Ubuntu but it's only for support, big community, user friendliness. If you really want to optimize for speed, i'll give you two advices:

  1. close / uninstall every unneeded daemon. In most Linux distro, as well as Windows, there are some services which start by default that probably aren't required by your app.

  2. if you can, compile your own kernel. Lately it has grown to include support for a lot of thing (hardware devices, network protocols...). If you are able to include just what you need, you'll have a lighter, faster kernel. I am not experienced in Gentoo, but if really compiles the kernel, lettin you choose what should be included, it's what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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