{"action":"created","comment":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/203454008","pull_request_review_id":138346372,"id":203454008,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzQ1NDAwOA==","diff_hunk":"@@ -0,0 +1,64 @@\n+package loadbalancingbenchmark\n+\n+import (\n+\t\"math/rand\"\n+\t\"sync\"\n+\t\"time\"\n+)\n+\n+type Server struct {\n+\tid            int\n+\tcounter       int\n+\tlistener      RequestWriter\n+\tstart         chan EmptySignal\n+\tstop          chan EmptySignal\n+\twg            *sync.WaitGroup\n+\tlatencyConfig *LatencyConfig\n+\tmachineType   MachineType\n+}\n+\n+func NewServer(id int, machineType MachineType, latencyConfig *LatencyConfig, sg *ServerListenerGroup, start, stop chan EmptySignal, wg *sync.WaitGroup) (*Server, error) {\n+\treturn &Server{\n+\t\tid:            id,\n+\t\tlistener:      sg.GetListener(id),\n+\t\tstart:         start,\n+\t\tstop:          stop,\n+\t\twg:            wg,\n+\t\tlatencyConfig: latencyConfig,\n+\t\tmachineType:   machineType,\n+\t}, nil\n+}\n+\n+func (s *Server) getRandomDelay() time.Duration {\n+\tr := rand.Intn(101)\n+\tif r <= 50 {\n+\t\treturn time.Duration(int(float32(s.latencyConfig.P50) / float32(50) * float32(r)))\n+\t} else if r <= 90 {\n+\t\treturn s.latencyConfig.P50 + time.Duration(int(float32(s.latencyConfig.P90-s.latencyConfig.P50)/float32(40)*float32(r-50)))\n+\t} else if r <= 99 {\n+\t\treturn s.latencyConfig.P90 + time.Duration(int(float32(s.latencyConfig.P99-s.latencyConfig.P90)/float32(9)*float32(r-90)))\n+\t} else {\n+\t\treturn s.latencyConfig.P100\n+\t}\n+}\n+\n+func (s *Server) handle(res ResponseWriter) {\n+\tdelay := s.getRandomDelay()\n+\ttime.Sleep(delay)\n+\tclose(res)","path":"internal/loadbalancebenchmark/server.go","position":48,"original_position":48,"commit_id":"599a54360398cbc11080a1cf0ff4557a9803d40f","original_commit_id":"599a54360398cbc11080a1cf0ff4557a9803d40f","user":{"login":"sxzh93","id":26440156,"node_id":"MDQ6VXNlcjI2NDQwMTU2","avatar_url":"https://avatars1.githubusercontent.com/u/26440156?v=4","gravatar_id":"","url":"https://api.github.com/users/sxzh93","html_url":"https://github.com/sxzh93","followers_url":"https://api.github.com/users/sxzh93/followers","following_url":"https://api.github.com/users/sxzh93/following{/other_user}","gists_url":"https://api.github.com/users/sxzh93/gists{/gist_id}","starred_url":"https://api.github.com/users/sxzh93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sxzh93/subscriptions","organizations_url":"https://api.github.com/users/sxzh93/orgs","repos_url":"https://api.github.com/users/sxzh93/repos","events_url":"https://api.github.com/users/sxzh93/events{/privacy}","received_events_url":"https://api.github.com/users/sxzh93/received_events","type":"User","site_admin":false},"body":"merged","created_at":"2018-07-18T16:54:12Z","updated_at":"2018-07-18T16:54:12Z","html_url":"https://github.com/yarpc/yarpc-go/pull/1526#discussion_r203454008","pull_request_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/203454008"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/1526#discussion_r203454008"},"pull_request":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526"}},"in_reply_to_id":202878515},"pull_request":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526","id":201794790,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNzk0Nzkw","html_url":"https://github.com/yarpc/yarpc-go/pull/1526","diff_url":"https://github.com/yarpc/yarpc-go/pull/1526.diff","patch_url":"https://github.com/yarpc/yarpc-go/pull/1526.patch","issue_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/1526","number":1526,"state":"open","locked":false,"title":"[WIP] Create benchmark for YARPC load balancing and subsetting","user":{"login":"sxzh93","id":26440156,"node_id":"MDQ6VXNlcjI2NDQwMTU2","avatar_url":"https://avatars1.githubusercontent.com/u/26440156?v=4","gravatar_id":"","url":"https://api.github.com/users/sxzh93","html_url":"https://github.com/sxzh93","followers_url":"https://api.github.com/users/sxzh93/followers","following_url":"https://api.github.com/users/sxzh93/following{/other_user}","gists_url":"https://api.github.com/users/sxzh93/gists{/gist_id}","starred_url":"https://api.github.com/users/sxzh93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sxzh93/subscriptions","organizations_url":"https://api.github.com/users/sxzh93/orgs","repos_url":"https://api.github.com/users/sxzh93/repos","events_url":"https://api.github.com/users/sxzh93/events{/privacy}","received_events_url":"https://api.github.com/users/sxzh93/received_events","type":"User","site_admin":false},"body":"Still working on unit tests, style, comments, better configuration for server type, better constant RPS implementation at Client side.","created_at":"2018-07-17T00:29:36Z","updated_at":"2018-07-18T16:54:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2dfa404e25fc2ce4ffd904a1ab618d5e88ed5db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526/commits","review_comments_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526/comments","review_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/1526/comments","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/599a54360398cbc11080a1cf0ff4557a9803d40f","head":{"label":"yarpc:lb_benchmark","ref":"lb_benchmark","sha":"599a54360398cbc11080a1cf0ff4557a9803d40f","user":{"login":"yarpc","id":16569504,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTY5NTA0","avatar_url":"https://avatars2.githubusercontent.com/u/16569504?v=4","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"node_id":"MDEwOlJlcG9zaXRvcnk1MDM5MDExMQ==","name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTY5NTA0","avatar_url":"https://avatars2.githubusercontent.com/u/16569504?v=4","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"A message passing platform for Go","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2018-07-18T04:09:41Z","pushed_at":"2018-07-18T15:03:45Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":10812,"stargazers_count":149,"watchers_count":149,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":31,"open_issues":10,"watchers":149,"default_branch":"dev"}},"base":{"label":"yarpc:dev","ref":"dev","sha":"ce94bab6cb0312e65dbc4bccf0a25be057caa47e","user":{"login":"yarpc","id":16569504,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTY5NTA0","avatar_url":"https://avatars2.githubusercontent.com/u/16569504?v=4","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"node_id":"MDEwOlJlcG9zaXRvcnk1MDM5MDExMQ==","name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTY5NTA0","avatar_url":"https://avatars2.githubusercontent.com/u/16569504?v=4","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"A message passing platform for Go","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2018-07-18T04:09:41Z","pushed_at":"2018-07-18T15:03:45Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":10812,"stargazers_count":149,"watchers_count":149,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":31,"open_issues":10,"watchers":149,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/1526"},"issue":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/1526"},"comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/1526/comments"},"review_comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526/comments"},"review_comment":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/1526/commits"},"statuses":{"href":"https://api.github.com/repos/yarpc/yarpc-go/statuses/599a54360398cbc11080a1cf0ff4557a9803d40f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sxzh93"}}