Pooling TCP Client Sockets
The client we built in the previous chapter works and can queue multiple callers, but it’s still operating sequentially—that is, it can only serve one request at a time. In a real-world system, this can work for some use cases, but most of the time you’ll want to be able to send requests concurrently as well. This is where pooling connections come into play. We’ll explore a couple of possible approaches to pooling.
The idea is to have a pool of multiple TCP client sockets connected to Redis and to choose a strategy to check out sockets from the pool when needed. We can implement this in several ways, and each may be a better fit for different use cases. Since we already have a working process-based Redis client, let’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access