qpstest.proto 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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
  47. required double time_elapsed = 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. }
  53. message Payload {
  54. // The type of data in body.
  55. optional PayloadType type = 1;
  56. // Primary contents of payload.
  57. optional bytes body = 2;
  58. }
  59. message HistogramData {
  60. repeated uint32 bucket = 1;
  61. required double min_seen = 2;
  62. required double max_seen = 3;
  63. required double sum = 4;
  64. required double sum_of_squares = 5;
  65. required double count = 6;
  66. }
  67. enum ClientType {
  68. SYNCHRONOUS_CLIENT = 1;
  69. ASYNC_CLIENT = 2;
  70. }
  71. enum ServerType {
  72. SYNCHRONOUS_SERVER = 1;
  73. ASYNC_SERVER = 2;
  74. }
  75. message ClientConfig {
  76. repeated string server_targets = 1;
  77. required ClientType client_type = 2;
  78. required bool enable_ssl = 3;
  79. required int32 outstanding_rpcs_per_channel = 4;
  80. required int32 client_channels = 5;
  81. required int32 payload_size = 6;
  82. }
  83. message Mark {}
  84. message ClientArgs {
  85. oneof argtype {
  86. ClientConfig setup = 1;
  87. Mark mark = 2;
  88. }
  89. }
  90. message ClientStats {
  91. required HistogramData latencies = 1;
  92. required double time_elapsed = 3;
  93. required double time_user = 4;
  94. required double time_system = 5;
  95. }
  96. message ClientStatus {
  97. optional ClientStats stats = 1;
  98. }
  99. message ServerConfig {
  100. required ServerType server_type = 1;
  101. required int32 threads = 2;
  102. required bool enable_ssl = 3;
  103. }
  104. message ServerArgs {
  105. oneof argtype {
  106. ServerConfig setup = 1;
  107. Mark mark = 2;
  108. }
  109. }
  110. message ServerStatus {
  111. optional ServerStats stats = 1;
  112. required int32 port = 2;
  113. }
  114. message SimpleRequest {
  115. // Desired payload type in the response from the server.
  116. // If response_type is RANDOM, server randomly chooses one from other formats.
  117. optional PayloadType response_type = 1 [default=COMPRESSABLE];
  118. // Desired payload size in the response from the server.
  119. // If response_type is COMPRESSABLE, this denotes the size before compression.
  120. optional int32 response_size = 2;
  121. // Optional input payload sent along with the request.
  122. optional Payload payload = 3;
  123. }
  124. message SimpleResponse {
  125. optional Payload payload = 1;
  126. }
  127. message StreamingInputCallRequest {
  128. // Optional input payload sent along with the request.
  129. optional Payload payload = 1;
  130. // Not expecting any payload from the response.
  131. }
  132. message StreamingInputCallResponse {
  133. // Aggregated size of payloads received from the client.
  134. optional int32 aggregated_payload_size = 1;
  135. }
  136. message ResponseParameters {
  137. // Desired payload sizes in responses from the server.
  138. // If response_type is COMPRESSABLE, this denotes the size before compression.
  139. required int32 size = 1;
  140. // Desired interval between consecutive responses in the response stream in
  141. // microseconds.
  142. required int32 interval_us = 2;
  143. }
  144. message StreamingOutputCallRequest {
  145. // Desired payload type in the response from the server.
  146. // If response_type is RANDOM, the payload from each response in the stream
  147. // might be of different types. This is to simulate a mixed type of payload
  148. // stream.
  149. optional PayloadType response_type = 1 [default=COMPRESSABLE];
  150. repeated ResponseParameters response_parameters = 2;
  151. // Optional input payload sent along with the request.
  152. optional Payload payload = 3;
  153. }
  154. message StreamingOutputCallResponse {
  155. optional Payload payload = 1;
  156. }
  157. service TestService {
  158. // One request followed by one response.
  159. // The server returns the client payload as-is.
  160. rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
  161. // One request followed by a sequence of responses (streamed download).
  162. // The server returns the payload with client desired type and sizes.
  163. rpc StreamingOutputCall(StreamingOutputCallRequest)
  164. returns (stream StreamingOutputCallResponse);
  165. // A sequence of requests followed by one response (streamed upload).
  166. // The server returns the aggregated size of client payload as the result.
  167. rpc StreamingInputCall(stream StreamingInputCallRequest)
  168. returns (StreamingInputCallResponse);
  169. // A sequence of requests with each request served by the server immediately.
  170. // As one request could lead to multiple responses, this interface
  171. // demonstrates the idea of full duplexing.
  172. rpc FullDuplexCall(stream StreamingOutputCallRequest)
  173. returns (stream StreamingOutputCallResponse);
  174. // A sequence of requests followed by a sequence of responses.
  175. // The server buffers all the client requests and then serves them in order. A
  176. // stream of responses are returned to the client when the server starts with
  177. // first request.
  178. rpc HalfDuplexCall(stream StreamingOutputCallRequest)
  179. returns (stream StreamingOutputCallResponse);
  180. }
  181. service Worker {
  182. // Start test with specified workload
  183. rpc RunTest(stream ClientArgs) returns (stream ClientStatus);
  184. // Start test with specified workload
  185. rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
  186. }