qps_openloop_test.cc
Go to the documentation of this file.
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 
25 #include "test/cpp/qps/driver.h"
26 #include "test/cpp/qps/report.h"
27 #include "test/cpp/qps/server.h"
30 
31 namespace grpc {
32 namespace testing {
33 
34 static const int WARMUP = 1;
35 static const int BENCHMARK = 3;
36 
37 static void RunQPS() {
38  gpr_log(GPR_INFO, "Running QPS test, open-loop");
39 
40  ClientConfig client_config;
41  client_config.set_client_type(ASYNC_CLIENT);
42  client_config.set_outstanding_rpcs_per_channel(100);
43  client_config.set_client_channels(8);
44  client_config.set_async_client_threads(8);
45  client_config.set_rpc_type(STREAMING);
46  client_config.mutable_load_params()->mutable_poisson()->set_offered_load(
47  1000.0 / grpc_test_slowdown_factor());
48 
49  ServerConfig server_config;
50  server_config.set_server_type(ASYNC_SERVER);
51  server_config.set_async_server_threads(8);
52 
53  const auto result =
54  RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2, "",
55  kInsecureCredentialsType, {}, false, 0);
56 
57  GetReporter()->ReportQPSPerCore(*result);
58  GetReporter()->ReportLatency(*result);
59 }
60 
61 } // namespace testing
62 } // namespace grpc
63 
64 int main(int argc, char** argv) {
66  grpc::testing::InitTest(&argc, &argv, true);
67 
69 
70  return 0;
71 }
test_credentials_provider.h
grpc::testing::InitTest
void InitTest(int *argc, char ***argv, bool remove_flags)
Definition: test_config_cc.cc:28
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
testing
Definition: aws_request_signer_test.cc:25
log.h
generate.env
env
Definition: generate.py:37
grpc
Definition: grpcpp/alarm.h:33
driver.h
grpc::testing::RunQPS
static void RunQPS()
Definition: qps_openloop_test.cc:37
benchmark_config.h
grpc::testing::kInsecureCredentialsType
const char kInsecureCredentialsType[]
Definition: test_credentials_provider.h:31
grpc::testing::RunScenario
std::unique_ptr< ScenarioResult > RunScenario(const ClientConfig &initial_client_config, size_t num_clients, const ServerConfig &initial_server_config, size_t num_servers, int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count, const std::string &qps_server_target_override, const std::string &credential_type, const std::map< std::string, std::string > &per_worker_credential_types, bool run_inproc, int32_t median_latency_collection_interval_millis)
Definition: driver.cc:365
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
framework.rpc.grpc_csds.ClientConfig
ClientConfig
Definition: grpc_csds.py:40
grpc_test_slowdown_factor
int64_t grpc_test_slowdown_factor()
Definition: test/core/util/test_config.cc:76
report.h
main
int main(int argc, char **argv)
Definition: qps_openloop_test.cc:64
test_config.h
grpc::testing::BENCHMARK
static const int BENCHMARK
Definition: inproc_sync_unary_ping_pong_test.cc:35
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
test_config.h
grpc::testing::GetReporter
std::shared_ptr< Reporter > GetReporter()
Definition: benchmark_config.cc:84
server.h
grpc::testing::WARMUP
static const int WARMUP
Definition: inproc_sync_unary_ping_pong_test.cc:34


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:50