-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit maximum size of connection pool #77
Comments
What is a reasonable pool size? I think the size to some extent could guide the strategy. |
On Linux systems, 1024 is a common default for ulimit_nofile, so we want to be below that, with some headroom for other tasks the program needs to do that use up fds. Go defaults to a MaxIdleConns of 100, which seems to work fine; let's do 100. |
jsha
added a commit
to jsha/ureq
that referenced
this issue
Jun 22, 2020
Adds limit of 100 connections to ConnectionPool. This is implemented with a VecDeque acting as an LRU. When the pool becomes full, the oldest stream is popped off the back from the VecDeque and also removed from the map of PoolKeys to Streams. Fixes algesten#77
jsha
added a commit
to jsha/ureq
that referenced
this issue
Jun 23, 2020
Adds limit of 100 connections to ConnectionPool. This is implemented with a VecDeque acting as an LRU. When the pool becomes full, the oldest stream is popped off the back from the VecDeque and also removed from the map of PoolKeys to Streams. Fixes algesten#77
jsha
added a commit
that referenced
this issue
Jun 24, 2020
Adds limit of 100 connections to ConnectionPool. This is implemented with a VecDeque acting as an LRU. When the pool becomes full, the oldest stream is popped off the back from the VecDeque and also removed from the map of PoolKeys to Streams. Fixes #77
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, connections stay in the pool indefinitely. If someone makes requests to a wide variety of hosts, that can quickly fill up the pool. Each entry in the pool uses an FD, and eventually a program will hit ulimit_nofile and stop working.
We should set a max size for the pool, and when a new connection needs to be added but the pool is full, remove one of the existing connections. A couple of options for how to remove:
The text was updated successfully, but these errors were encountered: