{"action":"created","issue":{"url":"https://api.github.com/repos/percona/mongodb_exporter/issues/79","repository_url":"https://api.github.com/repos/percona/mongodb_exporter","labels_url":"https://api.github.com/repos/percona/mongodb_exporter/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/percona/mongodb_exporter/issues/79/comments","events_url":"https://api.github.com/repos/percona/mongodb_exporter/issues/79/events","html_url":"https://github.com/percona/mongodb_exporter/pull/79","id":251278422,"number":79,"title":"Disable pre-fetching, limit conn pool and reuse db connection","user":{"login":"timvaillancourt","id":3202797,"avatar_url":"https://avatars0.githubusercontent.com/u/3202797?v=4","gravatar_id":"","url":"https://api.github.com/users/timvaillancourt","html_url":"https://github.com/timvaillancourt","followers_url":"https://api.github.com/users/timvaillancourt/followers","following_url":"https://api.github.com/users/timvaillancourt/following{/other_user}","gists_url":"https://api.github.com/users/timvaillancourt/gists{/gist_id}","starred_url":"https://api.github.com/users/timvaillancourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timvaillancourt/subscriptions","organizations_url":"https://api.github.com/users/timvaillancourt/orgs","repos_url":"https://api.github.com/users/timvaillancourt/repos","events_url":"https://api.github.com/users/timvaillancourt/events{/privacy}","received_events_url":"https://api.github.com/users/timvaillancourt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"AlekSi","id":11512,"avatar_url":"https://avatars1.githubusercontent.com/u/11512?v=4","gravatar_id":"","url":"https://api.github.com/users/AlekSi","html_url":"https://github.com/AlekSi","followers_url":"https://api.github.com/users/AlekSi/followers","following_url":"https://api.github.com/users/AlekSi/following{/other_user}","gists_url":"https://api.github.com/users/AlekSi/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekSi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekSi/subscriptions","organizations_url":"https://api.github.com/users/AlekSi/orgs","repos_url":"https://api.github.com/users/AlekSi/repos","events_url":"https://api.github.com/users/AlekSi/events{/privacy}","received_events_url":"https://api.github.com/users/AlekSi/received_events","type":"User","site_admin":false},"assignees":[{"login":"AlekSi","id":11512,"avatar_url":"https://avatars1.githubusercontent.com/u/11512?v=4","gravatar_id":"","url":"https://api.github.com/users/AlekSi","html_url":"https://github.com/AlekSi","followers_url":"https://api.github.com/users/AlekSi/followers","following_url":"https://api.github.com/users/AlekSi/following{/other_user}","gists_url":"https://api.github.com/users/AlekSi/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekSi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekSi/subscriptions","organizations_url":"https://api.github.com/users/AlekSi/orgs","repos_url":"https://api.github.com/users/AlekSi/repos","events_url":"https://api.github.com/users/AlekSi/events{/privacy}","received_events_url":"https://api.github.com/users/AlekSi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2017-08-18T15:21:06Z","updated_at":"2017-11-29T18:06:02Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/percona/mongodb_exporter/pulls/79","html_url":"https://github.com/percona/mongodb_exporter/pull/79","diff_url":"https://github.com/percona/mongodb_exporter/pull/79.diff","patch_url":"https://github.com/percona/mongodb_exporter/pull/79.patch"},"body":"On many systems I've seen the mongodb_exporter use very high CPU % under PMM 1.2.x. This PR aims to reduce some of the work the mgo driver is doing and reduce the amount of connections/log-noise from reconnecting each scrape.\r\n\r\n1. Disable cursor pre-fetching (not needed on simple exporter queries - wastes resources fetching 50 docs we won't use).\r\n2. Limit connection pool size to default 1. I added flag -mongodb.max-connections to control the pool limit. All other request will wait for the pool instead of creating more connections. Each additional mongodb connection adds CPU due to background pings, etc so it's best to restrict to a small number in this simple exporter.\r\n3. Re-use database connection to MongoDB. Currently we reconnect to the DB for every single scrape - this causes MongoDB to have to create a new connection (OS thread), setup buffers etc and log a lot of noise to the logfiles. This results in a single mongodb connection for the runtime of the exporter and mgo will reconnect if there is a failure all by itself. A .Close() method was added to cleanly close the session handle at end of program. Locking was added around the session due to race conditions."},"comment":{"url":"https://api.github.com/repos/percona/mongodb_exporter/issues/comments/347945606","html_url":"https://github.com/percona/mongodb_exporter/pull/79#issuecomment-347945606","issue_url":"https://api.github.com/repos/percona/mongodb_exporter/issues/79","id":347945606,"user":{"login":"timvaillancourt","id":3202797,"avatar_url":"https://avatars0.githubusercontent.com/u/3202797?v=4","gravatar_id":"","url":"https://api.github.com/users/timvaillancourt","html_url":"https://github.com/timvaillancourt","followers_url":"https://api.github.com/users/timvaillancourt/followers","following_url":"https://api.github.com/users/timvaillancourt/following{/other_user}","gists_url":"https://api.github.com/users/timvaillancourt/gists{/gist_id}","starred_url":"https://api.github.com/users/timvaillancourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timvaillancourt/subscriptions","organizations_url":"https://api.github.com/users/timvaillancourt/orgs","repos_url":"https://api.github.com/users/timvaillancourt/repos","events_url":"https://api.github.com/users/timvaillancourt/events{/privacy}","received_events_url":"https://api.github.com/users/timvaillancourt/received_events","type":"User","site_admin":false},"created_at":"2017-11-29T18:06:02Z","updated_at":"2017-11-29T18:06:02Z","author_association":"CONTRIBUTOR","body":"@AlekSi / @michaelcoburn: anything holding this PR back? I think this would be very beneficial to rollout asap"}}
{"actor":{"display_login":"timvaillancourt"}}