Writing Servers with focus and integration

I always believed that integration and focus are a success key for any kind of thing on this life. When talking about technology and servers specifically, integration may be a fundamental part to achieve different goals like good performance. Years ago was very valuable to have a software that can work on multiple Operating Systems, but there is a point that if you want to increase your performance limits you need to look forward for integration.

In the last years, Linux have become the best choice for Servers, it’s well known that every big company trust in Linux and also commit to their development: Redhat, Oracle, Google, HP, IBM and many many others. So we can say that Linux is doing pretty well on professional Hardware, but what about user-space software ?.

If we look in the HTTP Servers (or Web Servers) context, we will find that most used solutions are made to support different platforms and on specific build-time for a specific Operating System, different approaches are used to work better, in servers performance and resources consumption are critical, and when moving those solution to Embedded even more, so every taken decision may sacrifice something, we do in OS portability.

Monkey HTTP Server and Duda I/O are written with focus on the Linux Kernel, every Unix operating system despite their POSIX API, provides extra system calls that aims to extend functionality and offer features. Of course this kind of integration have a cost which is basically: do not be portable to other Operating System, so depending of your human resources you need to decide how to invest better: we do in focus and integration, and it works great.

As a reference i would like to mention which specific features we use and i hope people who write servers or any kind of networking application would take this in count. Of course  these are dependent of specific Linux Kernel versions:

Linux 3.14

  • TCP AutoCorking: let Kernel do smart buffering when sending outgoing data, the old fashion way is to do manual Cork over sockets (more).

Linux 3.9

  • SO_REUSEPORT: be able to reuse port-addresses, e.g: multiple threads under same process can bind the same port and let the Kernel distribute load across them (more).

Linux 3.7

  • TCP FastOpen: Reduce the number of round-trip required in a TCP conversation (more).

Also other very helpful interfaces exists such as accept4(2), sendfile(2), epoll(7) and splice(2), these are not the only ones but that should be considered when writing a Server for Linux.

We are in good times where performance matters and make a good design to make distribute load across multi-core architectures is fun and challenging. Again, if you write with focus and integration will be a win:win relationship between your network server and the HW behind it.