D.Tkalcec (RTC)
|
|
« Reply #1 on: September 03, 2014, 07:38:03 PM » |
|
HTTP is a request/response-based protocol, where each request from a Client has to be followed by a response from the Server, after which the Client can send the next request, the Server sends the response for that request, and so on. Even if you post several requests into the request queue on the Client side, the Client will never be sending more than one request to the Server at a time. After sending the first request to the Server, the Client will be waiting for a response from the Server. Only after receiving a complete response for the last request, then Client will check if there are more requests waiting in the request queue and then send the next request, following the same requst/response pattern.
The purpose of a connection pool is to reuse a connection which has been used before, but is currently NOT in use. In other words, you should return a connection back into the connection pool only AFTER the last request posted through that connection has been aborted, or a complete response was received. You will need to dinamically create new connections when there is no connection waiting in the pool, or implement a mechanism to wait for a connection to return to the pool if the number of connections already created is about to exceed your allowed limit.
Best Regards, Danijel Tkalcec
|