{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/48246018","id":48246018,"diff_hunk":"@@ -0,0 +1,162 @@\n+/*\n+Copyright 2014 The Kubernetes Authors All rights reserved.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package scheduler\n+\n+import (\n+\t\"github.com/golang/groupcache/lru\"\n+\t\"hash/adler32\"\n+\n+\t\"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/util\"\n+\t\"k8s.io/kubernetes/pkg/util/sets\"\n+\t\"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm\"\n+\tschedulerapi \"k8s.io/kubernetes/plugin/pkg/scheduler/api\"\n+)\n+\n+const maxCacheEntries = 4096\n+\n+type HostPredicate struct {\n+\tFit        bool\n+\tFailReason sets.String\n+}\n+\n+type podCacheEnty struct {\n+\tFit        bool\n+\tFailReason sets.String\n+\tScore      schedulerapi.HostPriority\n+}\n+\n+type NodeCache struct {\n+\tpredicatesCache *lru.Cache\n+\tprioritiesCache *lru.Cache\n+}","path":"plugin/pkg/scheduler/cache.go","position":46,"original_position":46,"commit_id":"75635f4471db9b1eb905686a581ee724f4c0a16d","original_commit_id":"75635f4471db9b1eb905686a581ee724f4c0a16d","user":{"login":"mqliang","id":12423751,"avatar_url":"https://avatars.githubusercontent.com/u/12423751?v=3","gravatar_id":"","url":"https://api.github.com/users/mqliang","html_url":"https://github.com/mqliang","followers_url":"https://api.github.com/users/mqliang/followers","following_url":"https://api.github.com/users/mqliang/following{/other_user}","gists_url":"https://api.github.com/users/mqliang/gists{/gist_id}","starred_url":"https://api.github.com/users/mqliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mqliang/subscriptions","organizations_url":"https://api.github.com/users/mqliang/orgs","repos_url":"https://api.github.com/users/mqliang/repos","events_url":"https://api.github.com/users/mqliang/events{/privacy}","received_events_url":"https://api.github.com/users/mqliang/received_events","type":"User","site_admin":false},"body":"Should we add a sync.RWMutex for those cache? since the list&watch client of scheduler could invalidate cache(see my another comment),  and scheduler will read the cache when it schedule a pod. ","created_at":"2015-12-22T11:42:07Z","updated_at":"2015-12-22T11:42:07Z","html_url":"https://github.com/kubernetes/kubernetes/pull/18938#discussion_r48246018","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/48246018"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/18938#discussion_r48246018"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938","id":54204596,"html_url":"https://github.com/kubernetes/kubernetes/pull/18938","diff_url":"https://github.com/kubernetes/kubernetes/pull/18938.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/18938.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18938","number":18938,"state":"open","locked":false,"title":"WIP: Cache predicates and priorities","user":{"login":"jiangyaoguo","id":6777418,"avatar_url":"https://avatars.githubusercontent.com/u/6777418?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangyaoguo","html_url":"https://github.com/jiangyaoguo","followers_url":"https://api.github.com/users/jiangyaoguo/followers","following_url":"https://api.github.com/users/jiangyaoguo/following{/other_user}","gists_url":"https://api.github.com/users/jiangyaoguo/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangyaoguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangyaoguo/subscriptions","organizations_url":"https://api.github.com/users/jiangyaoguo/orgs","repos_url":"https://api.github.com/users/jiangyaoguo/repos","events_url":"https://api.github.com/users/jiangyaoguo/events{/privacy}","received_events_url":"https://api.github.com/users/jiangyaoguo/received_events","type":"User","site_admin":false},"body":"#17390","created_at":"2015-12-20T18:11:35Z","updated_at":"2015-12-22T11:42:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ab92ea1c8a6132f239d5ee780ef29925ba46bf3","assignee":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18938/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/75635f4471db9b1eb905686a581ee724f4c0a16d","head":{"label":"jiangyaoguo:implement-equivalence-class","ref":"implement-equivalence-class","sha":"75635f4471db9b1eb905686a581ee724f4c0a16d","user":{"login":"jiangyaoguo","id":6777418,"avatar_url":"https://avatars.githubusercontent.com/u/6777418?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangyaoguo","html_url":"https://github.com/jiangyaoguo","followers_url":"https://api.github.com/users/jiangyaoguo/followers","following_url":"https://api.github.com/users/jiangyaoguo/following{/other_user}","gists_url":"https://api.github.com/users/jiangyaoguo/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangyaoguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangyaoguo/subscriptions","organizations_url":"https://api.github.com/users/jiangyaoguo/orgs","repos_url":"https://api.github.com/users/jiangyaoguo/repos","events_url":"https://api.github.com/users/jiangyaoguo/events{/privacy}","received_events_url":"https://api.github.com/users/jiangyaoguo/received_events","type":"User","site_admin":false},"repo":{"id":33133739,"name":"kubernetes","full_name":"jiangyaoguo/kubernetes","owner":{"login":"jiangyaoguo","id":6777418,"avatar_url":"https://avatars.githubusercontent.com/u/6777418?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangyaoguo","html_url":"https://github.com/jiangyaoguo","followers_url":"https://api.github.com/users/jiangyaoguo/followers","following_url":"https://api.github.com/users/jiangyaoguo/following{/other_user}","gists_url":"https://api.github.com/users/jiangyaoguo/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangyaoguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangyaoguo/subscriptions","organizations_url":"https://api.github.com/users/jiangyaoguo/orgs","repos_url":"https://api.github.com/users/jiangyaoguo/repos","events_url":"https://api.github.com/users/jiangyaoguo/events{/privacy}","received_events_url":"https://api.github.com/users/jiangyaoguo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiangyaoguo/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/jiangyaoguo/kubernetes","forks_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/forks","keys_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/teams","hooks_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/events","assignees_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/tags","blobs_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/languages","stargazers_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/subscription","commits_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/merges","archive_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/downloads","issues_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/jiangyaoguo/kubernetes/releases{/id}","created_at":"2015-03-30T16:10:38Z","updated_at":"2015-04-09T16:04:58Z","pushed_at":"2015-12-21T04:39:19Z","git_url":"git://github.com/jiangyaoguo/kubernetes.git","ssh_url":"git@github.com:jiangyaoguo/kubernetes.git","clone_url":"https://github.com/jiangyaoguo/kubernetes.git","svn_url":"https://github.com/jiangyaoguo/kubernetes","homepage":"http://kubernetes.io","size":139258,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"439d7a721e087f4015191fe7e2d0b9262abd2530","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-12-22T08:34:19Z","pushed_at":"2015-12-22T11:33:48Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":297237,"stargazers_count":11832,"watchers_count":11832,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3260,"mirror_url":null,"open_issues_count":2591,"forks":3260,"open_issues":2591,"watchers":11832,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/18938"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/18938"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/18938/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18938/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/75635f4471db9b1eb905686a581ee724f4c0a16d"}}}}