1 //
2 //
3 // Copyright 2015 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 //
18
19 #include <set>
20
21 #include <grpc/support/log.h>
22
23 #include "src/core/lib/gprpp/crash.h"
24 #include "test/core/util/test_config.h"
25 #include "test/cpp/qps/benchmark_config.h"
26 #include "test/cpp/qps/driver.h"
27 #include "test/cpp/qps/report.h"
28 #include "test/cpp/qps/server.h"
29 #include "test/cpp/util/test_config.h"
30 #include "test/cpp/util/test_credentials_provider.h"
31
32 namespace grpc {
33 namespace testing {
34
35 static const int WARMUP = 1;
36 static const int BENCHMARK = 3;
37
RunQPS()38 static void RunQPS() {
39 gpr_log(GPR_INFO, "Running QPS test, open-loop");
40
41 ClientConfig client_config;
42 client_config.set_client_type(ASYNC_CLIENT);
43 client_config.set_outstanding_rpcs_per_channel(100);
44 client_config.set_client_channels(8);
45 client_config.set_async_client_threads(8);
46 client_config.set_rpc_type(STREAMING);
47 client_config.mutable_load_params()->mutable_poisson()->set_offered_load(
48 1000.0 / grpc_test_slowdown_factor());
49
50 ServerConfig server_config;
51 server_config.set_server_type(ASYNC_SERVER);
52 server_config.set_async_server_threads(8);
53
54 const auto result =
55 RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2, "",
56 kInsecureCredentialsType, {}, false, 0);
57
58 GetReporter()->ReportQPSPerCore(*result);
59 GetReporter()->ReportLatency(*result);
60 }
61
62 } // namespace testing
63 } // namespace grpc
64
main(int argc,char ** argv)65 int main(int argc, char** argv) {
66 grpc::testing::TestEnvironment env(&argc, argv);
67 grpc::testing::InitTest(&argc, &argv, true);
68
69 grpc::testing::RunQPS();
70
71 return 0;
72 }
73