{"action":"created","issue":{"url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/79","repository_url":"https://api.github.com/repos/mediocregopher/radix.v2","labels_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/79/comments","events_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/79/events","html_url":"https://github.com/mediocregopher/radix.v2/pull/79","id":311084087,"number":79,"title":"Optional rate limiting of new connections and help prevent churn","user":{"login":"fastest963","id":112555,"avatar_url":"https://avatars3.githubusercontent.com/u/112555?v=4","gravatar_id":"","url":"https://api.github.com/users/fastest963","html_url":"https://github.com/fastest963","followers_url":"https://api.github.com/users/fastest963/followers","following_url":"https://api.github.com/users/fastest963/following{/other_user}","gists_url":"https://api.github.com/users/fastest963/gists{/gist_id}","starred_url":"https://api.github.com/users/fastest963/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastest963/subscriptions","organizations_url":"https://api.github.com/users/fastest963/orgs","repos_url":"https://api.github.com/users/fastest963/repos","events_url":"https://api.github.com/users/fastest963/events{/privacy}","received_events_url":"https://api.github.com/users/fastest963/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-04-04T04:47:05Z","updated_at":"2018-05-19T08:36:49Z","closed_at":"2018-05-19T08:35:44Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/mediocregopher/radix.v2/pulls/79","html_url":"https://github.com/mediocregopher/radix.v2/pull/79","diff_url":"https://github.com/mediocregopher/radix.v2/pull/79.diff","patch_url":"https://github.com/mediocregopher/radix.v2/pull/79.patch"},"body":"We've been having an issue in production where thousands of connections are created/closed/repeat within a few seconds and the service runs out of file descriptors (because the old connections are left in TIME_WAIT) and is now in an unusable state. This PR adds a few things:\r\n\r\nFirst, a \"reserve pool\" was added to `Pool` and has a capacity of `10*size`. If the main pool is full, this reserve pool is used to temporarily hold onto a client in case it is immediately needed again. This should help prevent connection churn if more than `size` connections are needed temporarily. Over a period of 100 seconds, the reserve pool is drained re-using the ping timer.\r\n\r\nSecond, instead of potentially creating a new connection just to ping, we only look for a client in the pool.\r\n\r\nThird, an optional \"limited\" pool can be created with a token bucket system that only allows `size` clients\r\nto be created roughly every 10 seconds. The bucket is refilled at a rate of `10/size` seconds. This also re-uses the ping timer. I left this default to off since technically it's backward-incompatible but we plan on turning it on in almost all cases. A `PoolLimited` bool was added to the `cluster.Opts` struct to enable this functionality."},"comment":{"url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/comments/390389818","html_url":"https://github.com/mediocregopher/radix.v2/pull/79#issuecomment-390389818","issue_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/79","id":390389818,"user":{"login":"mediocregopher","id":933154,"avatar_url":"https://avatars0.githubusercontent.com/u/933154?v=4","gravatar_id":"","url":"https://api.github.com/users/mediocregopher","html_url":"https://github.com/mediocregopher","followers_url":"https://api.github.com/users/mediocregopher/followers","following_url":"https://api.github.com/users/mediocregopher/following{/other_user}","gists_url":"https://api.github.com/users/mediocregopher/gists{/gist_id}","starred_url":"https://api.github.com/users/mediocregopher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediocregopher/subscriptions","organizations_url":"https://api.github.com/users/mediocregopher/orgs","repos_url":"https://api.github.com/users/mediocregopher/repos","events_url":"https://api.github.com/users/mediocregopher/events{/privacy}","received_events_url":"https://api.github.com/users/mediocregopher/received_events","type":"User","site_admin":false},"created_at":"2018-05-19T08:36:49Z","updated_at":"2018-05-19T08:36:49Z","author_association":"OWNER","body":"Sorry that took so long, @fastest963 I'm gonna just close those other prs, was easier to merge them all here"}}
{"actor":{"display_login":"mediocregopher"}}