{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/47871267","id":47871267,"diff_hunk":"@@ -199,6 +202,25 @@ func (m *httpMembersAPI) Remove(ctx context.Context, memberID string) error {\n \treturn assertStatusCode(resp.StatusCode, http.StatusNoContent, http.StatusGone)\n }\n \n+func (m *httpMembersAPI) Leader(ctx context.Context) (*Member, error) {","path":"client/members.go","position":14,"original_position":14,"commit_id":"bc0644d4d4a94266b5f1a5ec87bdcc09f879aace","original_commit_id":"bc0644d4d4a94266b5f1a5ec87bdcc09f879aace","user":{"login":"mitake","id":1173955,"avatar_url":"https://avatars.githubusercontent.com/u/1173955?v=3","gravatar_id":"","url":"https://api.github.com/users/mitake","html_url":"https://github.com/mitake","followers_url":"https://api.github.com/users/mitake/followers","following_url":"https://api.github.com/users/mitake/following{/other_user}","gists_url":"https://api.github.com/users/mitake/gists{/gist_id}","starred_url":"https://api.github.com/users/mitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitake/subscriptions","organizations_url":"https://api.github.com/users/mitake/orgs","repos_url":"https://api.github.com/users/mitake/repos","events_url":"https://api.github.com/users/mitake/events{/privacy}","received_events_url":"https://api.github.com/users/mitake/received_events","type":"User","site_admin":false},"body":"Sure, I'll add the test later.","created_at":"2015-12-17T05:40:42Z","updated_at":"2015-12-17T05:40:42Z","html_url":"https://github.com/coreos/etcd/pull/3950#discussion_r47871267","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/3950","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/47871267"},"html":{"href":"https://github.com/coreos/etcd/pull/3950#discussion_r47871267"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/3950"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/3950","id":52521934,"html_url":"https://github.com/coreos/etcd/pull/3950","diff_url":"https://github.com/coreos/etcd/pull/3950.diff","patch_url":"https://github.com/coreos/etcd/pull/3950.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/3950","number":3950,"state":"open","locked":false,"title":"client: an option for prioritizing a leader node as a request destina…","user":{"login":"mitake","id":1173955,"avatar_url":"https://avatars.githubusercontent.com/u/1173955?v=3","gravatar_id":"","url":"https://api.github.com/users/mitake","html_url":"https://github.com/mitake","followers_url":"https://api.github.com/users/mitake/followers","following_url":"https://api.github.com/users/mitake/following{/other_user}","gists_url":"https://api.github.com/users/mitake/gists{/gist_id}","starred_url":"https://api.github.com/users/mitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitake/subscriptions","organizations_url":"https://api.github.com/users/mitake/orgs","repos_url":"https://api.github.com/users/mitake/repos","events_url":"https://api.github.com/users/mitake/events{/privacy}","received_events_url":"https://api.github.com/users/mitake/received_events","type":"User","site_admin":false},"body":"…tion\r\n\r\nCurrent etcd client library chooses a default destination node from\r\nevery member of a cluster in a random manner. However, requests of\r\nwrite and read (for consistent results) need to be forwarded to the\r\nleader node as the nature of Raft algorithm. If the chosen node is a\r\nfollower, additional network traffic will be caused by the forwarding\r\nfrom follower to leader.\r\n\r\nFor reducing the forward traffic, this commit adds a new option\r\nPrioritizeLeader to client.Config. If this variable is true, the\r\nlibrary chooses the leader node as a default destination of request.\r\n\r\nI evaluated the effectiveness of this commit with 4 t1.micro\r\ninstances of AWS (3 nodes for etcd cluster and 1 node for etcd\r\nclient). Client executes this simple benchmark\r\n(https://github.com/mitake/etcd-things/tree/master/prioritize-leader-bench),\r\njust writes 10000 keys. When PrioritizeLeader is false, the benchmark\r\nneeded 1 min and 32.102 sec to finish. When it is true, the benchmark\r\nneeded 1 min 4.760 sec.\r\n\r\nMajor ToDos:\r\n- more benchmarks\r\n- refreshing an index of leader node in a case of leader failure\r\n","created_at":"2015-12-03T11:25:19Z","updated_at":"2015-12-17T05:40:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51c918c7063a59ee1fe33a113c0181dbdd3146be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/3950/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/3950/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/3950/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/bc0644d4d4a94266b5f1a5ec87bdcc09f879aace","head":{"label":"mitake:prioritize-leader","ref":"prioritize-leader","sha":"bc0644d4d4a94266b5f1a5ec87bdcc09f879aace","user":{"login":"mitake","id":1173955,"avatar_url":"https://avatars.githubusercontent.com/u/1173955?v=3","gravatar_id":"","url":"https://api.github.com/users/mitake","html_url":"https://github.com/mitake","followers_url":"https://api.github.com/users/mitake/followers","following_url":"https://api.github.com/users/mitake/following{/other_user}","gists_url":"https://api.github.com/users/mitake/gists{/gist_id}","starred_url":"https://api.github.com/users/mitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitake/subscriptions","organizations_url":"https://api.github.com/users/mitake/orgs","repos_url":"https://api.github.com/users/mitake/repos","events_url":"https://api.github.com/users/mitake/events{/privacy}","received_events_url":"https://api.github.com/users/mitake/received_events","type":"User","site_admin":false},"repo":{"id":40219422,"name":"etcd","full_name":"mitake/etcd","owner":{"login":"mitake","id":1173955,"avatar_url":"https://avatars.githubusercontent.com/u/1173955?v=3","gravatar_id":"","url":"https://api.github.com/users/mitake","html_url":"https://github.com/mitake","followers_url":"https://api.github.com/users/mitake/followers","following_url":"https://api.github.com/users/mitake/following{/other_user}","gists_url":"https://api.github.com/users/mitake/gists{/gist_id}","starred_url":"https://api.github.com/users/mitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitake/subscriptions","organizations_url":"https://api.github.com/users/mitake/orgs","repos_url":"https://api.github.com/users/mitake/repos","events_url":"https://api.github.com/users/mitake/events{/privacy}","received_events_url":"https://api.github.com/users/mitake/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mitake/etcd","description":"A distributed consistent key-value store for shared configuration and service discovery","fork":true,"url":"https://api.github.com/repos/mitake/etcd","forks_url":"https://api.github.com/repos/mitake/etcd/forks","keys_url":"https://api.github.com/repos/mitake/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitake/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitake/etcd/teams","hooks_url":"https://api.github.com/repos/mitake/etcd/hooks","issue_events_url":"https://api.github.com/repos/mitake/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/mitake/etcd/events","assignees_url":"https://api.github.com/repos/mitake/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/mitake/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/mitake/etcd/tags","blobs_url":"https://api.github.com/repos/mitake/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitake/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitake/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitake/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitake/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/mitake/etcd/languages","stargazers_url":"https://api.github.com/repos/mitake/etcd/stargazers","contributors_url":"https://api.github.com/repos/mitake/etcd/contributors","subscribers_url":"https://api.github.com/repos/mitake/etcd/subscribers","subscription_url":"https://api.github.com/repos/mitake/etcd/subscription","commits_url":"https://api.github.com/repos/mitake/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitake/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitake/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitake/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitake/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/mitake/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitake/etcd/merges","archive_url":"https://api.github.com/repos/mitake/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitake/etcd/downloads","issues_url":"https://api.github.com/repos/mitake/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/mitake/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/mitake/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/mitake/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitake/etcd/labels{/name}","releases_url":"https://api.github.com/repos/mitake/etcd/releases{/id}","created_at":"2015-08-05T02:10:59Z","updated_at":"2015-08-05T02:11:01Z","pushed_at":"2015-12-17T04:15:15Z","git_url":"git://github.com/mitake/etcd.git","ssh_url":"git@github.com:mitake/etcd.git","clone_url":"https://github.com/mitake/etcd.git","svn_url":"https://github.com/mitake/etcd","homepage":"","size":19391,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"coreos:master","ref":"master","sha":"9b0b15c9be660695082d683bee6d0b5ea59904c4","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":11225014,"name":"etcd","full_name":"coreos/etcd","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":false,"url":"https://api.github.com/repos/coreos/etcd","forks_url":"https://api.github.com/repos/coreos/etcd/forks","keys_url":"https://api.github.com/repos/coreos/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd/teams","hooks_url":"https://api.github.com/repos/coreos/etcd/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd/events","assignees_url":"https://api.github.com/repos/coreos/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd/tags","blobs_url":"https://api.github.com/repos/coreos/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd/subscription","commits_url":"https://api.github.com/repos/coreos/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd/merges","archive_url":"https://api.github.com/repos/coreos/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd/downloads","issues_url":"https://api.github.com/repos/coreos/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd/releases{/id}","created_at":"2013-07-06T21:57:21Z","updated_at":"2015-12-17T02:50:49Z","pushed_at":"2015-12-17T04:15:16Z","git_url":"git://github.com/coreos/etcd.git","ssh_url":"git@github.com:coreos/etcd.git","clone_url":"https://github.com/coreos/etcd.git","svn_url":"https://github.com/coreos/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":21795,"stargazers_count":8253,"watchers_count":8253,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1299,"mirror_url":null,"open_issues_count":168,"forks":1299,"open_issues":168,"watchers":8253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/3950"},"html":{"href":"https://github.com/coreos/etcd/pull/3950"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/3950"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/3950/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/3950/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/3950/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/bc0644d4d4a94266b5f1a5ec87bdcc09f879aace"}}}}