Closed bhenderson closed 4 years ago
Through a thread pool connections can be safely shared across threads, but I have been lazy and have not implemented it.
At this point in the life of net-http-persistent I think it is appropriate to add a connection pool.
I think the way to implement pooling would be for #connection_for to check out a connection for the current thread and #request would check the connection back in. #connection_for would also grow the ability to limit the total number of connections outstanding.
Now supported.
I've talked to you about this in the past, I just wanted a place to keep track of the discussion.
One of the issues we've run into is our production apps run more threads then some of our backends can handle, so we need a way to limit the number of connections.
One question I have is can the connections be shared between threads safely? I'm assuming not because you made it thread safe to begin with.
So, if we have 6 theads, and want to limit to 5 connections, do we make the 6th thread wait until one of the others releases the connection?
thanks,