Summary
In this chapter, we examined several approaches to address the scalability of applications. Scalability refers to the ability of an application to compensate for increased loads placed on it. While our examples focused on applying these techniques to servers, they are equally applicable to clients.
We introduced three threading architectures, and we focused on two of them: thread-per-request and thread-per-connection. The thread-per-request model creates a new thread for each request that arrives at a server. This is suitable for situations where a client will make a single or possibly a few requests at a time.
The thread-per-connection model will create a thread to handle multiple requests from a client. This avoids having to reconnect to the client multiple times and having to incur the cost of multiple thread creations. This approach is good for clients who need to maintain a session and possibly state information.
Thread pools support an approach that avoids creating and destroying...