{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/29077379","id":29077379,"diff_hunk":"@@ -0,0 +1,185 @@\n+/*\n+ * Copyright 2015, Google Inc. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are\n+ * met:\n+ *\n+ *    * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ *    * Redistributions in binary form must reproduce the above\n+ * copyright notice, this list of conditions and the following disclaimer\n+ * in the documentation and/or other materials provided with the\n+ * distribution.\n+ *\n+ *    * Neither the name of Google Inc. nor the names of its\n+ * contributors may be used to endorse or promote products derived from\n+ * this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package io.grpc.benchmarks.qps;\n+\n+import static java.lang.Math.max;\n+\n+import grpc.testing.Qpstest.PayloadType;\n+import grpc.testing.Qpstest.RpcType;\n+import io.grpc.transport.netty.NettyChannelBuilder;\n+\n+class ClientConfiguration {\n+\n+  boolean okhttp;\n+  boolean tls;\n+  boolean testca;\n+  boolean directExecutor;\n+  boolean dumpHistogram;\n+  int port;\n+  int channels = 4;\n+  int outstandingRpcsPerChannel = 10;\n+  int serverPayload;\n+  int clientPayload;\n+  int connectionWindow = NettyChannelBuilder.DEFAULT_CONNECTION_WINDOW_SIZE;\n+  int streamWindow = NettyChannelBuilder.DEFAULT_CONNECTION_WINDOW_SIZE;\n+  // seconds\n+  int duration = 60;\n+  // seconds\n+  int warmupDuration = 10;\n+  String host = \"127.0.0.1\";\n+  String histogramFile = \"latencies.hgrm\";\n+  RpcType rpcType = RpcType.UNARY;\n+  PayloadType payloadType = PayloadType.COMPRESSABLE;\n+\n+  private ClientConfiguration() {\n+  }\n+\n+  static ClientConfiguration parseArgs(String[] args) {\n+    ClientConfiguration c = new ClientConfiguration();\n+    boolean hasPort = false;\n+\n+    for (String arg : args) {\n+      if (!arg.startsWith(\"--\")) {\n+        throw new IllegalArgumentException(\"All arguments must start with '--': \" + arg);\n+      }\n+\n+      String[] pair = arg.substring(2).split(\"=\", 2);\n+      String key = pair[0];\n+      String value = \"\";\n+      if (pair.length == 2) {\n+        value = pair[1];\n+      }\n+\n+      if (\"help\".equals(key)) {\n+        printUsage();\n+        return null;\n+      } else if (\"port\".equals(key)) {\n+        c.port = Integer.parseInt(value);\n+        hasPort = true;\n+      } else if (\"host\".equals(key)) {\n+        c.host = value;\n+      } else if (\"channels\".equals(key)) {\n+        c.channels = max(Integer.parseInt(value), 1);\n+      } else if (\"outstanding_rpcs_per_channel\".equals(key)) {\n+        c.outstandingRpcsPerChannel = max(Integer.parseInt(value), 1);\n+      } else if (\"client_payload\".equals(key)) {\n+        c.clientPayload = max(Integer.parseInt(value), 0);\n+      } else if (\"server_payload\".equals(key)) {\n+        c.serverPayload = max(Integer.parseInt(value), 0);\n+      } else if (\"tls\".equals(key)) {\n+        c.tls = true;\n+      } else if (\"testca\".equals(key)) {\n+        c.testca = true;\n+      } else if (\"okhttp\".equals(key)) {\n+        c.okhttp = true;\n+      } else if (\"duration\".equals(key)) {\n+        c.duration = parseDuration(value);\n+      } else if (\"warmup_duration\".equals(key)) {\n+        c.warmupDuration = parseDuration(value);\n+      } else if (\"directexecutor\".equals(key)) {\n+        c.directExecutor = true;\n+      } else if (\"dump_histogram\".equals(key)) {\n+        c.dumpHistogram = true;\n+        if (!value.isEmpty()) {\n+          c.histogramFile = value;\n+        }\n+      } else if (\"streaming_rpcs\".equals(key)) {\n+        c.rpcType = RpcType.STREAMING;\n+      } else if (\"connection_window\".equals(key)) {\n+        c.connectionWindow = Integer.parseInt(value);\n+      } else if (\"stream_window\".equals(key)) {\n+        c.streamWindow = Integer.parseInt(value);\n+      } else {\n+        throw new IllegalArgumentException(\"Unrecognized argument '\" + key + \"'.\");\n+      }\n+    }\n+\n+    if (!hasPort) {\n+      throw new IllegalStateException(\"'--port' was not specified.\");","path":"benchmarks/src/main/java/io/grpc/benchmarks/qps/ClientConfiguration.java","position":127,"original_position":127,"commit_id":"c4362dfc6632dbf8194dbb8035392babe3e64192","original_commit_id":"c4362dfc6632dbf8194dbb8035392babe3e64192","user":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"body":"IllegalArgumentException?","created_at":"2015-04-24T19:16:17Z","updated_at":"2015-04-24T19:16:17Z","html_url":"https://github.com/grpc/grpc-java/pull/334#discussion_r29077379","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/334","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/29077379"},"html":{"href":"https://github.com/grpc/grpc-java/pull/334#discussion_r29077379"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/334"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/334","id":34007964,"html_url":"https://github.com/grpc/grpc-java/pull/334","diff_url":"https://github.com/grpc/grpc-java/pull/334.diff","patch_url":"https://github.com/grpc/grpc-java/pull/334.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/334","number":334,"state":"open","locked":false,"title":"Update QPS Client and Server.","user":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars.githubusercontent.com/u/1388179?v=3","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"body":"- Support for Streaming RPCs.\r\n- Support for using DirectExecutor.\r\n- Support for specifying a client payload size.\r\n- Support to export the histogram / latency distribution to file,\r\n  so that it can be visualized with a third party tool.\r\n- Support setting the server / client flow control window for the connection and stream.\r\n- Improved output format.\r\n- Latencies are no longer reported in nanos, but in micros instead.\r\n- Change warmup period to run the same code as in the actual benchmark.\r\n- Can no longer specify the total number of concurrent RPCs, but instead\r\n  the number of concurrent RPCs per channel.\r\n- Import the .proto file used by the C++ QPS package.\r\n- Code Cleanup","created_at":"2015-04-23T23:50:39Z","updated_at":"2015-04-24T19:16:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"711c8e13613e2396fcc0972285c02316cdf3b7b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/334/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/334/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/334/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/c4362dfc6632dbf8194dbb8035392babe3e64192","head":{"label":"buchgr:updateqps","ref":"updateqps","sha":"c4362dfc6632dbf8194dbb8035392babe3e64192","user":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars.githubusercontent.com/u/1388179?v=3","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"repo":{"id":31381511,"name":"grpc-java","full_name":"buchgr/grpc-java","owner":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars.githubusercontent.com/u/1388179?v=3","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/buchgr/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/buchgr/grpc-java","forks_url":"https://api.github.com/repos/buchgr/grpc-java/forks","keys_url":"https://api.github.com/repos/buchgr/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buchgr/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buchgr/grpc-java/teams","hooks_url":"https://api.github.com/repos/buchgr/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/buchgr/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/buchgr/grpc-java/events","assignees_url":"https://api.github.com/repos/buchgr/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/buchgr/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/buchgr/grpc-java/tags","blobs_url":"https://api.github.com/repos/buchgr/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buchgr/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buchgr/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/buchgr/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buchgr/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/buchgr/grpc-java/languages","stargazers_url":"https://api.github.com/repos/buchgr/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/buchgr/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/buchgr/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/buchgr/grpc-java/subscription","commits_url":"https://api.github.com/repos/buchgr/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/buchgr/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/buchgr/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/buchgr/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/buchgr/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/buchgr/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buchgr/grpc-java/merges","archive_url":"https://api.github.com/repos/buchgr/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buchgr/grpc-java/downloads","issues_url":"https://api.github.com/repos/buchgr/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/buchgr/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/buchgr/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/buchgr/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buchgr/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/buchgr/grpc-java/releases{/id}","created_at":"2015-02-26T18:18:24Z","updated_at":"2015-03-11T21:25:43Z","pushed_at":"2015-04-24T19:07:31Z","git_url":"git://github.com/buchgr/grpc-java.git","ssh_url":"git@github.com:buchgr/grpc-java.git","clone_url":"https://github.com/buchgr/grpc-java.git","svn_url":"https://github.com/buchgr/grpc-java","homepage":"","size":2046,"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":"3a4f4b5a06bb0e58c1a89808f157d2852ba34658","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-04-24T17:50:30Z","pushed_at":"2015-04-24T19:07:32Z","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":17741,"stargazers_count":664,"watchers_count":664,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":63,"forks":137,"open_issues":63,"watchers":664,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/334"},"html":{"href":"https://github.com/grpc/grpc-java/pull/334"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/334"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/334/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/334/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/334/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/c4362dfc6632dbf8194dbb8035392babe3e64192"}}}}