qpstest.proto 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // Copyright 2015, Google Inc.
  2. // All rights reserved.
  3. //
  4. // Redistribution and use in source and binary forms, with or without
  5. // modification, are permitted provided that the following conditions are
  6. // met:
  7. //
  8. // * Redistributions of source code must retain the above copyright
  9. // notice, this list of conditions and the following disclaimer.
  10. // * Redistributions in binary form must reproduce the above
  11. // copyright notice, this list of conditions and the following disclaimer
  12. // in the documentation and/or other materials provided with the
  13. // distribution.
  14. // * Neither the name of Google Inc. nor the names of its
  15. // contributors may be used to endorse or promote products derived from
  16. // this software without specific prior written permission.
  17. //
  18. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. // An integration test service that covers all the method signature permutations
  30. // of unary/streaming requests/responses.
  31. syntax = "proto2";
  32. package grpc.testing;
  33. enum PayloadType {
  34. // Compressable text format.
  35. COMPRESSABLE= 1;
  36. // Uncompressable binary format.
  37. UNCOMPRESSABLE = 2;
  38. // Randomly chosen from all other formats defined in this enum.
  39. RANDOM = 3;
  40. }
  41. message StatsRequest {
  42. // run number
  43. optional int32 test_num = 1;
  44. }
  45. message ServerStats {
  46. // wall clock time for timestamp
  47. required double time_now = 1;
  48. // user time used by the server process and threads
  49. required double time_user = 2;
  50. // server time used by the server process and all threads
  51. required double time_system = 3;
  52. // RPC count so far
  53. optional int32 num_rpcs = 4;
  54. }
  55. message Payload {
  56. // The type of data in body.
  57. optional PayloadType type = 1;
  58. // Primary contents of payload.
  59. optional bytes body = 2;
  60. }
  61. message Latencies {
  62. required double l_50 = 1;
  63. required double l_90 = 2;
  64. required double l_99 = 3;
  65. required double l_999 = 4;
  66. }
  67. message ClientArgs {
  68. required string server_target = 1;
  69. required bool enable_ssl = 3;
  70. required int32 client_threads = 4;
  71. // We have a configurable number of channels for sending RPCs.
  72. // RPCs are sent round-robin on the available channels by the
  73. // various threads. Interesting cases are 1 global channel or
  74. // 1 per-thread channel, but we can support any number.
  75. // The channels are assigned round-robin on an RPC by RPC basis
  76. // rather than just at initialization time in order to also measure the
  77. // impact of cache thrashing caused by channel changes. This is an issue
  78. // if you are not in one of the above "interesting cases"
  79. required int32 client_channels = 5;
  80. required int32 num_rpcs = 6;
  81. required int32 payload_size = 7;
  82. }
  83. message ClientResult {
  84. required Latencies latencies = 1;
  85. required int32 num_rpcs = 2;
  86. required double time_elapsed = 3;
  87. required double time_user = 4;
  88. required double time_system = 5;
  89. }
  90. message ServerArgs {
  91. required int32 threads = 1;
  92. }
  93. message ServerStatus {
  94. optional ServerStats stats = 1;
  95. }
  96. message SimpleRequest {
  97. // Desired payload type in the response from the server.
  98. // If response_type is RANDOM, server randomly chooses one from other formats.
  99. optional PayloadType response_type = 1 [default=COMPRESSABLE];
  100. // Desired payload size in the response from the server.
  101. // If response_type is COMPRESSABLE, this denotes the size before compression.
  102. optional int32 response_size = 2;
  103. // Optional input payload sent along with the request.
  104. optional Payload payload = 3;
  105. }
  106. message SimpleResponse {
  107. optional Payload payload = 1;
  108. }
  109. message StreamingInputCallRequest {
  110. // Optional input payload sent along with the request.
  111. optional Payload payload = 1;
  112. // Not expecting any payload from the response.
  113. }
  114. message StreamingInputCallResponse {
  115. // Aggregated size of payloads received from the client.
  116. optional int32 aggregated_payload_size = 1;
  117. }
  118. message ResponseParameters {
  119. // Desired payload sizes in responses from the server.
  120. // If response_type is COMPRESSABLE, this denotes the size before compression.
  121. required int32 size = 1;
  122. // Desired interval between consecutive responses in the response stream in
  123. // microseconds.
  124. required int32 interval_us = 2;
  125. }
  126. message StreamingOutputCallRequest {
  127. // Desired payload type in the response from the server.
  128. // If response_type is RANDOM, the payload from each response in the stream
  129. // might be of different types. This is to simulate a mixed type of payload
  130. // stream.
  131. optional PayloadType response_type = 1 [default=COMPRESSABLE];
  132. repeated ResponseParameters response_parameters = 2;
  133. // Optional input payload sent along with the request.
  134. optional Payload payload = 3;
  135. }
  136. message StreamingOutputCallResponse {
  137. optional Payload payload = 1;
  138. }
  139. service TestService {
  140. // Collect stats from server, ignore request content
  141. rpc CollectServerStats(StatsRequest) returns (ServerStats);
  142. // One request followed by one response.
  143. // The server returns the client payload as-is.
  144. rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
  145. // One request followed by a sequence of responses (streamed download).
  146. // The server returns the payload with client desired type and sizes.
  147. rpc StreamingOutputCall(StreamingOutputCallRequest)
  148. returns (stream StreamingOutputCallResponse);
  149. // A sequence of requests followed by one response (streamed upload).
  150. // The server returns the aggregated size of client payload as the result.
  151. rpc StreamingInputCall(stream StreamingInputCallRequest)
  152. returns (StreamingInputCallResponse);
  153. // A sequence of requests with each request served by the server immediately.
  154. // As one request could lead to multiple responses, this interface
  155. // demonstrates the idea of full duplexing.
  156. rpc FullDuplexCall(stream StreamingOutputCallRequest)
  157. returns (stream StreamingOutputCallResponse);
  158. // A sequence of requests followed by a sequence of responses.
  159. // The server buffers all the client requests and then serves them in order. A
  160. // stream of responses are returned to the client when the server starts with
  161. // first request.
  162. rpc HalfDuplexCall(stream StreamingOutputCallRequest)
  163. returns (stream StreamingOutputCallResponse);
  164. }
  165. service QpsClient {
  166. // Start test with specified workload
  167. rpc RunTest(ClientArgs) returns (ClientResult);
  168. }
  169. service QpsServer {
  170. // Start test with specified workload
  171. rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
  172. }