1// Copyright 2015 gRPC authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17import "src/proto/grpc/testing/payloads.proto";
18import "src/proto/grpc/testing/stats.proto";
19
20package grpc.testing;
21
22enum ClientType {
23  // Many languages support a basic distinction between using
24  // sync or async client, and this allows the specification
25  SYNC_CLIENT = 0;
26  ASYNC_CLIENT = 1;
27  OTHER_CLIENT = 2; // used for some language-specific variants
28}
29
30enum ServerType {
31  SYNC_SERVER = 0;
32  ASYNC_SERVER = 1;
33  ASYNC_GENERIC_SERVER = 2;
34  OTHER_SERVER = 3; // used for some language-specific variants
35}
36
37enum RpcType {
38  UNARY = 0;
39  STREAMING = 1;
40  STREAMING_FROM_CLIENT = 2;
41  STREAMING_FROM_SERVER = 3;
42  STREAMING_BOTH_WAYS = 4;
43}
44
45// Parameters of poisson process distribution, which is a good representation
46// of activity coming in from independent identical stationary sources.
47message PoissonParams {
48  // The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
49  double offered_load = 1;
50}
51
52// Once an RPC finishes, immediately start a new one.
53// No configuration parameters needed.
54message ClosedLoopParams {}
55
56message LoadParams {
57  oneof load {
58    ClosedLoopParams closed_loop = 1;
59    PoissonParams poisson = 2;
60  };
61}
62
63// presence of SecurityParams implies use of TLS
64message SecurityParams {
65  bool use_test_ca = 1;
66  string server_host_override = 2;
67  string cred_type = 3;
68}
69
70message ChannelArg {
71  string name = 1;
72  oneof value {
73    string str_value = 2;
74    int32 int_value = 3;
75  }
76}
77
78message ClientConfig {
79  // List of targets to connect to. At least one target needs to be specified.
80  repeated string server_targets = 1;
81  ClientType client_type = 2;
82  SecurityParams security_params = 3;
83  // How many concurrent RPCs to start for each channel.
84  // For synchronous client, use a separate thread for each outstanding RPC.
85  int32 outstanding_rpcs_per_channel = 4;
86  // Number of independent client channels to create.
87  // i-th channel will connect to server_target[i % server_targets.size()]
88  int32 client_channels = 5;
89  // Only for async client. Number of threads to use to start/manage RPCs.
90  int32 async_client_threads = 7;
91  RpcType rpc_type = 8;
92  // The requested load for the entire client (aggregated over all the threads).
93  LoadParams load_params = 10;
94  PayloadConfig payload_config = 11;
95  HistogramParams histogram_params = 12;
96
97  // Specify the cores we should run the client on, if desired
98  repeated int32 core_list = 13;
99  int32 core_limit = 14;
100
101  // If we use an OTHER_CLIENT client_type, this string gives more detail
102  string other_client_api = 15;
103
104  repeated ChannelArg channel_args = 16;
105
106  // Number of threads that share each completion queue
107  int32 threads_per_cq = 17;
108
109  // Number of messages on a stream before it gets finished/restarted
110  int32 messages_per_stream = 18;
111
112  // Use coalescing API when possible.
113  bool use_coalesce_api = 19;
114
115  // If 0, disabled. Else, specifies the period between gathering latency
116  // medians in milliseconds.
117  int32 median_latency_collection_interval_millis = 20;
118}
119
120message ClientStatus { ClientStats stats = 1; }
121
122// Request current stats
123message Mark {
124  // if true, the stats will be reset after taking their snapshot.
125  bool reset = 1;
126}
127
128message ClientArgs {
129  oneof argtype {
130    ClientConfig setup = 1;
131    Mark mark = 2;
132  }
133}
134
135message ServerConfig {
136  ServerType server_type = 1;
137  SecurityParams security_params = 2;
138  // Port on which to listen. Zero means pick unused port.
139  int32 port = 4;
140  // Only for async server. Number of threads used to serve the requests.
141  int32 async_server_threads = 7;
142  // Specify the number of cores to limit server to, if desired
143  int32 core_limit = 8;
144  // payload config, used in generic server.
145  // Note this must NOT be used in proto (non-generic) servers. For proto servers,
146  // 'response sizes' must be configured from the 'response_size' field of the
147  // 'SimpleRequest' objects in RPC requests.
148  PayloadConfig payload_config = 9;
149
150  // Specify the cores we should run the server on, if desired
151  repeated int32 core_list = 10;
152
153  // If we use an OTHER_SERVER client_type, this string gives more detail
154  string other_server_api = 11;
155
156  // Number of threads that share each completion queue
157  int32 threads_per_cq = 12;
158
159  // c++-only options (for now) --------------------------------
160
161  // Buffer pool size (no buffer pool specified if unset)
162  int32 resource_quota_size = 1001;
163  repeated ChannelArg channel_args = 1002;
164}
165
166message ServerArgs {
167  oneof argtype {
168    ServerConfig setup = 1;
169    Mark mark = 2;
170  }
171}
172
173message ServerStatus {
174  ServerStats stats = 1;
175  // the port bound by the server
176  int32 port = 2;
177  // Number of cores available to the server
178  int32 cores = 3;
179}
180
181message CoreRequest {
182}
183
184message CoreResponse {
185  // Number of cores available on the server
186  int32 cores = 1;
187}
188
189message Void {
190}
191
192// A single performance scenario: input to qps_json_driver
193message Scenario {
194  // Human readable name for this scenario
195  string name = 1;
196  // Client configuration
197  ClientConfig client_config = 2;
198  // Number of clients to start for the test
199  int32 num_clients = 3;
200  // Server configuration
201  ServerConfig server_config = 4;
202  // Number of servers to start for the test
203  int32 num_servers = 5;
204  // Warmup period, in seconds
205  int32 warmup_seconds = 6;
206  // Benchmark time, in seconds
207  int32 benchmark_seconds = 7;
208  // Number of workers to spawn locally (usually zero)
209  int32 spawn_local_worker_count = 8;
210}
211
212// A set of scenarios to be run with qps_json_driver
213message Scenarios {
214  repeated Scenario scenarios = 1;
215}
216
217// Basic summary that can be computed from ClientStats and ServerStats
218// once the scenario has finished.
219message ScenarioResultSummary
220{
221  // Total number of operations per second over all clients.
222  double qps = 1;
223  // QPS per one server core.
224  double qps_per_server_core = 2;
225  // server load based on system_time (0.85 => 85%)
226  double server_system_time = 3;
227  // server load based on user_time (0.85 => 85%)
228  double server_user_time = 4;
229  // client load based on system_time (0.85 => 85%)
230  double client_system_time = 5;
231  // client load based on user_time (0.85 => 85%)
232  double client_user_time = 6;
233
234  // X% latency percentiles (in nanoseconds)
235  double latency_50 = 7;
236  double latency_90 = 8;
237  double latency_95 = 9;
238  double latency_99 = 10;
239  double latency_999 = 11;
240
241  // server cpu usage percentage
242  double server_cpu_usage = 12;
243
244  // Number of requests that succeeded/failed
245  double successful_requests_per_second = 13;
246  double failed_requests_per_second = 14;
247
248  // Number of polls called inside completion queue per request
249  double client_polls_per_request = 15;
250  double server_polls_per_request = 16;
251
252  // Queries per CPU-sec over all servers or clients
253  double server_queries_per_cpu_sec = 17;
254  double client_queries_per_cpu_sec = 18;
255}
256
257// Results of a single benchmark scenario.
258message ScenarioResult {
259  // Inputs used to run the scenario.
260  Scenario scenario = 1;
261  // Histograms from all clients merged into one histogram.
262  HistogramData latencies = 2;
263  // Client stats for each client
264  repeated ClientStats client_stats = 3;
265  // Server stats for each server
266  repeated ServerStats server_stats = 4;
267  // Number of cores available to each server
268  repeated int32 server_cores = 5;
269  // An after-the-fact computed summary
270  ScenarioResultSummary summary = 6;
271  // Information on success or failure of each worker
272  repeated bool client_success = 7;
273  repeated bool server_success = 8;
274  // Number of failed requests (one row per status code seen)
275  repeated RequestResultCount request_results = 9;
276}
277