Service A calls into service B via HTTP. This happens frequently, and the size of transferred data is not very big. I discovered that re-using the same TCP connection to send multiple requests from A to B seems to improve latency. Naturally, the idea of connection pooling comes to mind:
- Open multiple connections to service B and keep them alive
- When A needs to make a call to B, provide it with one of the connections from the pool
Implementing this involves solving some problems which are outside of the scope of what I'm trying to do, so I'm looking for a cheap way to implement this (maybe have some specifically configured proxy server between A and B?).
I could just jump in and start coding, but this problem seems so common that I'm pretty sure someone has already solved it before.