{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/30632724","id":30632724,"diff_hunk":"@@ -0,0 +1,105 @@\n+package io.grpc.benchmarks.netty;\n+\n+import org.openjdk.jmh.annotations.AuxCounters;\n+import org.openjdk.jmh.annotations.Benchmark;\n+import org.openjdk.jmh.annotations.Fork;\n+import org.openjdk.jmh.annotations.Level;\n+import org.openjdk.jmh.annotations.Param;\n+import org.openjdk.jmh.annotations.Scope;\n+import org.openjdk.jmh.annotations.Setup;\n+import org.openjdk.jmh.annotations.State;\n+import org.openjdk.jmh.annotations.TearDown;\n+\n+import java.util.concurrent.atomic.AtomicBoolean;\n+import java.util.concurrent.atomic.AtomicLong;\n+\n+/**\n+ * Benchmark measuring messages per second received from a streaming server. The server\n+ * is obeying outbound flow-control.\n+ */\n+@State(Scope.Benchmark)\n+@Fork(1)\n+public class FlowControlledMessagesPerSecondBenchmark extends AbstractBenchmark {\n+\n+  @Param({\"1\", \"2\", \"4\"})\n+  public int channelCount = 1;\n+\n+  @Param({\"1\", \"2\", \"10\", \"100\"})\n+  public int maxConcurrentStreams = 1;\n+\n+  @Param\n+  public ExecutorType clientExecutor = ExecutorType.DIRECT;\n+\n+  @Param({\"SMALL\"})\n+  public PayloadSize responseSize = PayloadSize.SMALL;\n+\n+  private static AtomicLong callCounter;\n+  private AtomicBoolean completed;\n+\n+  /**\n+   * Use an AuxCounter so we can measure that calls as they occur without consuming CPU\n+   * in the benchmark method.\n+   */\n+  @AuxCounters\n+  @State(Scope.Thread)\n+  public static class AdditionalCounters {\n+\n+    @Setup(Level.Iteration)\n+    public void clean() {\n+      callCounter.set(0);\n+    }\n+\n+    public long messagesPerSecond() {\n+      return callCounter.get();\n+    }\n+  }\n+\n+  /**\n+   * Setup with direct executors, small payloads and the default flow-control window.\n+   */\n+  @Setup(Level.Trial)\n+  public void setup() throws Exception {\n+    super.setup(clientExecutor,\n+        ExecutorType.DIRECT,\n+        PayloadSize.SMALL,\n+        responseSize,\n+        FlowWindowSize.MEDIUM,\n+        ChannelType.NIO,\n+        maxConcurrentStreams,\n+        channelCount);\n+    callCounter = new AtomicLong();\n+    completed = new AtomicBoolean();\n+    startFlowControlledStreamingCalls(maxConcurrentStreams, callCounter, completed, 1);\n+  }\n+\n+  /**\n+   * Stop the running calls then stop the server and client channels.\n+   */\n+  @TearDown(Level.Trial)\n+  public void stopChannelsAndServers() throws Exception {","path":"benchmarks/src/jmh/java/io/grpc/benchmarks/netty/FlowControlledMessagesPerSecondBenchmark.java","position":79,"original_position":79,"commit_id":"94ecdbc8f8cccc23ae21508f55657912eea29efd","original_commit_id":"94ecdbc8f8cccc23ae21508f55657912eea29efd","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"body":"Done, here and elsewhere","created_at":"2015-05-19T18:48:04Z","updated_at":"2015-05-19T18:48:04Z","html_url":"https://github.com/grpc/grpc-java/pull/447#discussion_r30632724","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/30632724"},"html":{"href":"https://github.com/grpc/grpc-java/pull/447#discussion_r30632724"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/447","id":35668614,"html_url":"https://github.com/grpc/grpc-java/pull/447","diff_url":"https://github.com/grpc/grpc-java/pull/447.diff","patch_url":"https://github.com/grpc/grpc-java/pull/447.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/447","number":447,"state":"open","locked":false,"title":"Add new benchmarks","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"body":"@ejona86 \r\n\r\nAdd additional benchmarks including:\r\n\r\n- streaming ping-pong messages per second\r\n- unary response bandwidth in megabits per second\r\n- streaming response bandwidth in megabits per second","created_at":"2015-05-18T20:08:52Z","updated_at":"2015-05-19T18:48:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5e77454ce5cffafeb13b69dfff2cf16409b3421","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/447/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/447/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/447/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/94ecdbc8f8cccc23ae21508f55657912eea29efd","head":{"label":"louiscryan:NewBenchmarks","ref":"NewBenchmarks","sha":"94ecdbc8f8cccc23ae21508f55657912eea29efd","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"repo":{"id":31382190,"name":"grpc-java","full_name":"louiscryan/grpc-java","owner":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/louiscryan/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/louiscryan/grpc-java","forks_url":"https://api.github.com/repos/louiscryan/grpc-java/forks","keys_url":"https://api.github.com/repos/louiscryan/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/louiscryan/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/louiscryan/grpc-java/teams","hooks_url":"https://api.github.com/repos/louiscryan/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/louiscryan/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/louiscryan/grpc-java/events","assignees_url":"https://api.github.com/repos/louiscryan/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/louiscryan/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/louiscryan/grpc-java/tags","blobs_url":"https://api.github.com/repos/louiscryan/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/louiscryan/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/louiscryan/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/louiscryan/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/louiscryan/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/louiscryan/grpc-java/languages","stargazers_url":"https://api.github.com/repos/louiscryan/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/louiscryan/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/louiscryan/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/louiscryan/grpc-java/subscription","commits_url":"https://api.github.com/repos/louiscryan/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/louiscryan/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/louiscryan/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/louiscryan/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/louiscryan/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/louiscryan/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/louiscryan/grpc-java/merges","archive_url":"https://api.github.com/repos/louiscryan/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/louiscryan/grpc-java/downloads","issues_url":"https://api.github.com/repos/louiscryan/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/louiscryan/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/louiscryan/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/louiscryan/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/louiscryan/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/louiscryan/grpc-java/releases{/id}","created_at":"2015-02-26T18:33:49Z","updated_at":"2015-05-01T20:01:16Z","pushed_at":"2015-05-19T18:42:38Z","git_url":"git://github.com/louiscryan/grpc-java.git","ssh_url":"git@github.com:louiscryan/grpc-java.git","clone_url":"https://github.com/louiscryan/grpc-java.git","svn_url":"https://github.com/louiscryan/grpc-java","homepage":"","size":2606,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"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":"grpc:master","ref":"master","sha":"98c6355079c8d5b4540b14a8109ae3fd56bfe919","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729926,"name":"grpc-java","full_name":"grpc/grpc-java","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":false,"url":"https://api.github.com/repos/grpc/grpc-java","forks_url":"https://api.github.com/repos/grpc/grpc-java/forks","keys_url":"https://api.github.com/repos/grpc/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc-java/teams","hooks_url":"https://api.github.com/repos/grpc/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc-java/events","assignees_url":"https://api.github.com/repos/grpc/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc-java/tags","blobs_url":"https://api.github.com/repos/grpc/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc-java/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc-java/subscription","commits_url":"https://api.github.com/repos/grpc/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc-java/merges","archive_url":"https://api.github.com/repos/grpc/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc-java/downloads","issues_url":"https://api.github.com/repos/grpc/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc-java/releases{/id}","created_at":"2014-12-08T19:00:00Z","updated_at":"2015-05-19T08:12:47Z","pushed_at":"2015-05-19T18:42:38Z","git_url":"git://github.com/grpc/grpc-java.git","ssh_url":"git@github.com:grpc/grpc-java.git","clone_url":"https://github.com/grpc/grpc-java.git","svn_url":"https://github.com/grpc/grpc-java","homepage":"","size":19486,"stargazers_count":699,"watchers_count":699,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":57,"forks":149,"open_issues":57,"watchers":699,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/447"},"html":{"href":"https://github.com/grpc/grpc-java/pull/447"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/447"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/94ecdbc8f8cccc23ae21508f55657912eea29efd"}}}}