{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18255","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18255/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18255/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18255/events","html_url":"https://github.com/kubernetes/kubernetes/issues/18255","id":120598303,"number":18255,"title":"scheduler: inefficient cache operation slows down scheduler","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/team/control-plane","name":"team/control-plane","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-12-06T00:34:26Z","updated_at":"2015-12-08T00:46:45Z","closed_at":null,"body":"After https://github.com/kubernetes/kubernetes/issues/18126 fixed by https://github.com/kubernetes/kubernetes/pull/18170, I run density test again.\r\n\r\nNow the hot spot on the critical path is an inefficient cache access(https://github.com/kubernetes/kubernetes/blob/master/pkg/client/cache/store.go#L75) when listing nodes that uses reflection. Reflection causes a lot of allocations.\r\n\r\nA simple fix would be\r\n\r\n```go\r\nfunc NodeKeyFunc(obj interface{}) (string, error) {\r\n\tkey, ok := obj.(*api.Node)\r\n\tif !ok {\r\n\t\treturn \"\", fmt.Errorf(\"not *api.Node type\")\r\n\t}\r\n\tmeta := key.ObjectMeta\r\n\tif len(meta.Namespace) > 0 {\r\n\t\treturn meta.Namespace + \"/\" + meta.Name, nil\r\n\t}\r\n\treturn meta.Name, nil\r\n}\r\n```\r\n\r\nThe simple fix improves the throughput of scheduler by 15%-20% on 1000 nodes case.\r\n\r\n@lavalamp What do you think about this issue?\r\n\r\n/cc @hongchaodeng @wojtek-t @gmarek @davidopp "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/162717594","html_url":"https://github.com/kubernetes/kubernetes/issues/18255#issuecomment-162717594","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18255","id":162717594,"user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T00:46:45Z","updated_at":"2015-12-08T00:46:45Z","body":"I plan on making a separate PR for that shortly - we see this check show up in lots of large profiles so I want to make sure it goes away.  Will update both issues once I do that."}}