{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/etcd/issues/3950","labels_url":"https://api.github.com/repos/coreos/etcd/issues/3950/labels{/name}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/3950/comments","events_url":"https://api.github.com/repos/coreos/etcd/issues/3950/events","html_url":"https://github.com/coreos/etcd/pull/3950","id":120149559,"number":3950,"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-03T11:25:19Z","updated_at":"2015-12-03T22:29:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/3950","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"},"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"},"comment":{"url":"https://api.github.com/repos/coreos/etcd/issues/comments/161807845","html_url":"https://github.com/coreos/etcd/pull/3950#issuecomment-161807845","issue_url":"https://api.github.com/repos/coreos/etcd/issues/3950","id":161807845,"user":{"login":"gyuho","id":6799218,"avatar_url":"https://avatars.githubusercontent.com/u/6799218?v=3","gravatar_id":"","url":"https://api.github.com/users/gyuho","html_url":"https://github.com/gyuho","followers_url":"https://api.github.com/users/gyuho/followers","following_url":"https://api.github.com/users/gyuho/following{/other_user}","gists_url":"https://api.github.com/users/gyuho/gists{/gist_id}","starred_url":"https://api.github.com/users/gyuho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gyuho/subscriptions","organizations_url":"https://api.github.com/users/gyuho/orgs","repos_url":"https://api.github.com/users/gyuho/repos","events_url":"https://api.github.com/users/gyuho/events{/privacy}","received_events_url":"https://api.github.com/users/gyuho/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T22:29:21Z","updated_at":"2015-12-03T22:29:21Z","body":"@mitake Please `gofmt` your code. Test failed. Thanks!"}}