{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/17089","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/17089/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/17089/comments","events_url":"https://api.github.com/repos/golang/go/issues/17089/events","html_url":"https://github.com/golang/go/issues/17089","id":176644234,"number":17089,"title":"runtime: expose number of running/runnable goroutines","user":{"login":"fd","id":591,"avatar_url":"https://avatars.githubusercontent.com/u/591?v=3","gravatar_id":"","url":"https://api.github.com/users/fd","html_url":"https://github.com/fd","followers_url":"https://api.github.com/users/fd/followers","following_url":"https://api.github.com/users/fd/following{/other_user}","gists_url":"https://api.github.com/users/fd/gists{/gist_id}","starred_url":"https://api.github.com/users/fd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fd/subscriptions","organizations_url":"https://api.github.com/users/fd/orgs","repos_url":"https://api.github.com/users/fd/repos","events_url":"https://api.github.com/users/fd/events{/privacy}","received_events_url":"https://api.github.com/users/fd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/42","html_url":"https://github.com/golang/go/milestones/Go1.8Maybe","labels_url":"https://api.github.com/repos/golang/go/milestones/42/labels","id":1748849,"number":42,"title":"Go1.8Maybe","description":"","creator":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"open_issues":140,"closed_issues":30,"state":"open","created_at":"2016-05-04T23:40:26Z","updated_at":"2016-09-13T20:23:04Z","due_on":"2017-02-01T08:00:00Z","closed_at":null},"comments":5,"created_at":"2016-09-13T13:44:26Z","updated_at":"2016-09-13T23:02:38Z","closed_at":null,"body":"### Summary\r\n\r\nI'd like to propose a way to expose the number of active (running + runnable) goroutines.\r\n\r\n### Background\r\n\r\nMy primary use case for this metric is to estimate application load (`num-active-goroutines / num-cpu`) in order to implement load shedding. Other metrics, like the `times()` syscall, don't expose application overload and don't work well in the presence of noisy neighbours.\r\n\r\n### Plan\r\n\r\nCurrently the runtime package includes `runtime.NumGoroutine() int` which returns the number of live, non-system goroutines.\r\n\r\nThe runtime package could be extended to include `runtime.NumActiveGoroutine() int`. `NumActiveGoroutine()` should count all goroutines where `isSystemGoroutine()` is false and where status is `_Grunnable|_Grunning|_Gsyscall`.\r\n\r\nIt seems that such a function would need to acquire `sched.lock` and `allglock`. This could have some performance implications.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/246853549","html_url":"https://github.com/golang/go/issues/17089#issuecomment-246853549","issue_url":"https://api.github.com/repos/golang/go/issues/17089","id":246853549,"user":{"login":"ianlancetaylor","id":3194333,"avatar_url":"https://avatars.githubusercontent.com/u/3194333?v=3","gravatar_id":"","url":"https://api.github.com/users/ianlancetaylor","html_url":"https://github.com/ianlancetaylor","followers_url":"https://api.github.com/users/ianlancetaylor/followers","following_url":"https://api.github.com/users/ianlancetaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianlancetaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianlancetaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianlancetaylor/subscriptions","organizations_url":"https://api.github.com/users/ianlancetaylor/orgs","repos_url":"https://api.github.com/users/ianlancetaylor/repos","events_url":"https://api.github.com/users/ianlancetaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianlancetaylor/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T23:02:38Z","updated_at":"2016-09-13T23:02:38Z","body":"Oh, I see, but then the goroutines in state `_Gsyscall` are ambiguous, as they could be blocked."}}
{"actor":{"display_login":"ianlancetaylor"}}