{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/34735786","id":34735786,"diff_hunk":"@@ -0,0 +1,132 @@\n+## Abstract\n+\n+In the current system, all watch requests send to apiserver are in general\n+redirected to etcd. This means that for every watch request to apiserver,\n+apiserver opens a watch on etcd.\n+\n+The purpose of the proposal is to improve the overall performance of the system\n+by solving the following problems:\n+\n+- having too many open watches on etcd\n+- avoiding deserializing/converting the same objects multiple times in different\n+watch results\n+\n+In the future, we would also like to add an indexing mechanism to the watch.\n+Although Indexer is not part of this proposal, it is supposed to be compatible\n+with it - in the future Indexer should be incorporated into the proposed new\n+watch solution in apiserver without requiring any redesign.\n+\n+\n+## High level design\n+\n+We are going to solve those problems by allowing many clients to watch the same\n+storage in the apiserver, without being redirected to etcd.\n+\n+At the high level, apiserver will have a single watch open to etcd, watching all\n+the objects (of a given type) without any filtering. The changes delivered from\n+etcd will then be stored in a cache in apiserver. The introduced cache will have\n+a limited capacity - whenever a new change comes from etcd and the cache is full,\n+the oldest change will be removed to make place for the new change.","path":"docs/proposals/apiserver_watch.md","position":29,"original_position":29,"commit_id":"3bbb09e53135ad54518080f1aafba831cdbb2a66","original_commit_id":"3bbb09e53135ad54518080f1aafba831cdbb2a66","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},"body":"Index would be against deserialized API objects though, not against\nunderlying etcd objects.  So that presupposes a cache of API objects above\netcd that you index, which implies you hold those API objects in memory.\nThere doesn't seem to be much value in converting the etcd object to the\ninternal version for the index and then throwing that away.\n\nOr are you proposing indexing on raw etcd json, in which case we would be\nconverting the entire list every time we made a list call?\n\nIf we index above etcd we also are duplicating the lower level objects,\nwhich has some memory overhead.\n\nOn Jul 15, 2015, at 5:01 PM, Daniel Smith <notifications@github.com> wrote:\n\nIn docs/proposals/apiserver_watch.md\n<https://github.com/GoogleCloudPlatform/kubernetes/pull/10679#discussion_r34728704>\n:\n\n> +In the future, we would also like to add an indexing mechanism to the watch.\n> +Although Indexer is not part of this proposal, it is supposed to be compatible\n> +with it - in the future Indexer should be incorporated into the proposed new\n> +watch solution in apiserver without requiring any redesign.\n> +\n> +\n> +## High level design\n> +\n> +We are going to solve those problems by allowing many clients to watch the same\n> +storage in the apiserver, without being redirected to etcd.\n> +\n> +At the high level, apiserver will have a single watch open to etcd, watching all\n> +the objects (of a given type) without any filtering. The changes delivered from\n> +etcd will then be stored in a cache in apiserver. The introduced cache will have\n> +a limited capacity - whenever a new change comes from etcd and the cache is full,\n> +the oldest change will be removed to make place for the new change.\n\nIt's necessary if you want your response to LIST to be reasonably fast. We\nhave to have that to index, so we might as well do it now.\n\n—\nReply to this email directly or view it on GitHub\n<https://github.com/GoogleCloudPlatform/kubernetes/pull/10679/files#r34728704>\n.\n","created_at":"2015-07-15T22:10:16Z","updated_at":"2015-07-15T22:10:16Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679#discussion_r34735786","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/34735786"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679#discussion_r34735786"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679","id":39088797,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10679","number":10679,"state":"open","locked":false,"title":"Watch in apiserver proposal","user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"body":"This is (hopefully) cleaner and a bit more detailed proposal of having watch in apiserver than the one described in https://github.com/GoogleCloudPlatform/kubernetes/issues/10475#issuecomment-117211186. But the overall idea is mostly the same.\r\n\r\nRef #10475 \r\n\r\ncc @bprashanth @lavalamp @davidopp \r\ncc @smarterclayton @derekwaynecarr @timothysc","created_at":"2015-07-02T14:33:21Z","updated_at":"2015-07-15T22:10:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f6a9f27aab51bc7c3f1c7ea72bbe4b09e5ea4ed","assignee":{"login":"lavalamp","id":647318,"avatar_url":"https://avatars.githubusercontent.com/u/647318?v=3","gravatar_id":"","url":"https://api.github.com/users/lavalamp","html_url":"https://github.com/lavalamp","followers_url":"https://api.github.com/users/lavalamp/followers","following_url":"https://api.github.com/users/lavalamp/following{/other_user}","gists_url":"https://api.github.com/users/lavalamp/gists{/gist_id}","starred_url":"https://api.github.com/users/lavalamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavalamp/subscriptions","organizations_url":"https://api.github.com/users/lavalamp/orgs","repos_url":"https://api.github.com/users/lavalamp/repos","events_url":"https://api.github.com/users/lavalamp/events{/privacy}","received_events_url":"https://api.github.com/users/lavalamp/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/11","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/milestones/v1.0-post","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/11/labels","id":1035380,"number":11,"title":"v1.0-post","description":"Things that are triaged and decided not for inclusion to v1.0","creator":{"login":"brendandburns","id":5751682,"avatar_url":"https://avatars.githubusercontent.com/u/5751682?v=3","gravatar_id":"","url":"https://api.github.com/users/brendandburns","html_url":"https://github.com/brendandburns","followers_url":"https://api.github.com/users/brendandburns/followers","following_url":"https://api.github.com/users/brendandburns/following{/other_user}","gists_url":"https://api.github.com/users/brendandburns/gists{/gist_id}","starred_url":"https://api.github.com/users/brendandburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendandburns/subscriptions","organizations_url":"https://api.github.com/users/brendandburns/orgs","repos_url":"https://api.github.com/users/brendandburns/repos","events_url":"https://api.github.com/users/brendandburns/events{/privacy}","received_events_url":"https://api.github.com/users/brendandburns/received_events","type":"User","site_admin":false},"open_issues":475,"closed_issues":89,"state":"open","created_at":"2015-03-23T22:54:17Z","updated_at":"2015-07-15T22:00:09Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10679/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/3bbb09e53135ad54518080f1aafba831cdbb2a66","head":{"label":"wojtek-t:watch_in_apiserver_proposal","ref":"watch_in_apiserver_proposal","sha":"3bbb09e53135ad54518080f1aafba831cdbb2a66","user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"repo":{"id":30216785,"name":"kubernetes","full_name":"wojtek-t/kubernetes","owner":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wojtek-t/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/wojtek-t/kubernetes","forks_url":"https://api.github.com/repos/wojtek-t/kubernetes/forks","keys_url":"https://api.github.com/repos/wojtek-t/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wojtek-t/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wojtek-t/kubernetes/teams","hooks_url":"https://api.github.com/repos/wojtek-t/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/wojtek-t/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/wojtek-t/kubernetes/events","assignees_url":"https://api.github.com/repos/wojtek-t/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/wojtek-t/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/wojtek-t/kubernetes/tags","blobs_url":"https://api.github.com/repos/wojtek-t/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wojtek-t/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wojtek-t/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/wojtek-t/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wojtek-t/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/wojtek-t/kubernetes/languages","stargazers_url":"https://api.github.com/repos/wojtek-t/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/wojtek-t/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/wojtek-t/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/wojtek-t/kubernetes/subscription","commits_url":"https://api.github.com/repos/wojtek-t/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/wojtek-t/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/wojtek-t/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/wojtek-t/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/wojtek-t/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/wojtek-t/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wojtek-t/kubernetes/merges","archive_url":"https://api.github.com/repos/wojtek-t/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wojtek-t/kubernetes/downloads","issues_url":"https://api.github.com/repos/wojtek-t/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/wojtek-t/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/wojtek-t/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/wojtek-t/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wojtek-t/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/wojtek-t/kubernetes/releases{/id}","created_at":"2015-02-03T00:37:55Z","updated_at":"2015-04-30T12:14:58Z","pushed_at":"2015-07-15T12:39:02Z","git_url":"git://github.com/wojtek-t/kubernetes.git","ssh_url":"git@github.com:wojtek-t/kubernetes.git","clone_url":"https://github.com/wojtek-t/kubernetes.git","svn_url":"https://github.com/wojtek-t/kubernetes","homepage":"http://kubernetes.io","size":90290,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"ef41ceb3e477ceada84c5522f429f02ab0f5948e","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-07-15T18:45:00Z","pushed_at":"2015-07-15T22:01:03Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":315954,"stargazers_count":8923,"watchers_count":8923,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2028,"mirror_url":null,"open_issues_count":1599,"forks":2028,"open_issues":1599,"watchers":8923,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10679"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10679"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10679/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10679/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/3bbb09e53135ad54518080f1aafba831cdbb2a66"}}}}