7.1 Selecting a Web Server Architecture

In chapter 4, we have considered mechanisms for I/O handling and connection concurrency for web servers. Popular architectures that incorporate different I/O and concurrency mechanisms have been reviewed. We have seen that sufficient performance result can be achieved with various models and there are solid implementations for most of them. In our architectural scenario, the web servers are challenged with highly concurrent connections, extreme I/O parallelism, but virtually not shared state. In this particular case, event-driven architectures using asynchronous I/O tend to provide better scalability under load, by requiring less memory and gaining better CPU utilization. Yet, this does not displace thread-based servers in general. When web servers are used in general-purpose setups, perhaps also executing the application logic in the same server instance, thread-based web servers are still a valid contender.

If there is the urgent necessity to implement a custom web server, the choice of the right concepts is often constrained by the platform and the programming language. If available, I/O multiplexing strategies (asynchronous/non-blocking) and cooperative scheduling should be considered. Also, low-level frameworks should be reviewed, as described in the evaluation part of chapter 4. They often implement the basic building blocks of a network server and allow the developer to focus on protocol-dependant and application-specific features.