Why non-blocking IO A typical server application, such as a web server, needs to process thousands of request concurrently. Therefore, the modern web server needs to meet the following requirements. Handling of thousands of connections simultaneously (significant number of connections may be in idle state as well) Handling high latency connections Request/response handling needs to be decoupled Minimize latency, maximize throughput and avoiding unnecessary CPU cycles Hence, to cater to such requirements, there can be several possibilities in the server application architecture. Having a pool of sockets for each client, and periodically polling them: This is the most straightforward approach; however, it is more or less impractical without non-blocking sockets. This is extremely inefficient and never scales with the increasing number of connections. Thread per socket: This is the conventional approach and was initially used in some applications and this is the only practical solution wi...
Comentários
Postar um comentário