Skip to content
Snippets Groups Projects
Commit 76e0fb1d authored by Vijay Pai's avatar Vijay Pai
Browse files

Merge pull request #1669 from dgquintas/benchmark_hosts_info

Added the client and server configurations to the bench results proto.
parents 9e1dc8a3 08116501
No related branches found
No related tags found
No related merge requests found
...@@ -64,8 +64,8 @@ static void RunAsyncStreamingPingPong() { ...@@ -64,8 +64,8 @@ static void RunAsyncStreamingPingPong() {
const auto result = const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
ReportQPS(result); ReportQPS(*result);
ReportLatency(result); ReportLatency(*result);
} }
} // namespace testing } // namespace testing
......
...@@ -64,8 +64,8 @@ static void RunAsyncUnaryPingPong() { ...@@ -64,8 +64,8 @@ static void RunAsyncUnaryPingPong() {
const auto result = const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
ReportQPS(result); ReportQPS(*result);
ReportLatency(result); ReportLatency(*result);
} }
} // namespace testing } // namespace testing
......
...@@ -77,13 +77,10 @@ static deque<string> get_hosts(const string& name) { ...@@ -77,13 +77,10 @@ static deque<string> get_hosts(const string& name) {
} }
} }
ScenarioResult RunScenario(const ClientConfig& initial_client_config, std::unique_ptr<ScenarioResult> RunScenario(
size_t num_clients, const ClientConfig& initial_client_config, size_t num_clients,
const ServerConfig& server_config, const ServerConfig& server_config, size_t num_servers, int warmup_seconds,
size_t num_servers, int benchmark_seconds, int spawn_local_worker_count) {
int warmup_seconds,
int benchmark_seconds,
int spawn_local_worker_count) {
// ClientContext allocator (all are destroyed at scope exit) // ClientContext allocator (all are destroyed at scope exit)
list<ClientContext> contexts; list<ClientContext> contexts;
auto alloc_context = [&contexts]() { auto alloc_context = [&contexts]() {
...@@ -91,6 +88,11 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, ...@@ -91,6 +88,11 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
return &contexts.back(); return &contexts.back();
}; };
// To be added to the result, containing the final configuration used for
// client and config (incluiding host, etc.)
ClientConfig result_client_config;
ServerConfig result_server_config;
// Get client, server lists // Get client, server lists
auto workers = get_hosts("QPS_WORKERS"); auto workers = get_hosts("QPS_WORKERS");
ClientConfig client_config = initial_client_config; ClientConfig client_config = initial_client_config;
...@@ -139,6 +141,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, ...@@ -139,6 +141,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
sd.stub = std::move(Worker::NewStub( sd.stub = std::move(Worker::NewStub(
CreateChannel(workers[i], InsecureCredentials(), ChannelArguments()))); CreateChannel(workers[i], InsecureCredentials(), ChannelArguments())));
ServerArgs args; ServerArgs args;
result_server_config = server_config;
result_server_config.set_host(workers[i]);
*args.mutable_setup() = server_config; *args.mutable_setup() = server_config;
sd.stream = std::move(sd.stub->RunServer(alloc_context())); sd.stream = std::move(sd.stub->RunServer(alloc_context()));
GPR_ASSERT(sd.stream->Write(args)); GPR_ASSERT(sd.stream->Write(args));
...@@ -168,6 +172,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, ...@@ -168,6 +172,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
cd.stub = std::move(Worker::NewStub(CreateChannel( cd.stub = std::move(Worker::NewStub(CreateChannel(
workers[i + num_servers], InsecureCredentials(), ChannelArguments()))); workers[i + num_servers], InsecureCredentials(), ChannelArguments())));
ClientArgs args; ClientArgs args;
result_client_config = client_config;
result_client_config.set_host(workers[i + num_servers]);
*args.mutable_setup() = client_config; *args.mutable_setup() = client_config;
cd.stream = std::move(cd.stub->RunTest(alloc_context())); cd.stream = std::move(cd.stub->RunTest(alloc_context()));
GPR_ASSERT(cd.stream->Write(args)); GPR_ASSERT(cd.stream->Write(args));
...@@ -208,7 +214,9 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, ...@@ -208,7 +214,9 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds))); gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds)));
// Finish a run // Finish a run
ScenarioResult result; std::unique_ptr<ScenarioResult> result(new ScenarioResult);
result->client_config = result_client_config;
result->server_config = result_server_config;
gpr_log(GPR_INFO, "Finishing"); gpr_log(GPR_INFO, "Finishing");
for (auto server = servers.begin(); server != servers.end(); server++) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server->stream->Write(server_mark)); GPR_ASSERT(server->stream->Write(server_mark));
...@@ -219,14 +227,14 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, ...@@ -219,14 +227,14 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
for (auto server = servers.begin(); server != servers.end(); server++) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server->stream->Read(&server_status)); GPR_ASSERT(server->stream->Read(&server_status));
const auto& stats = server_status.stats(); const auto& stats = server_status.stats();
result.server_resources.push_back(ResourceUsage{ result->server_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()}); stats.time_elapsed(), stats.time_user(), stats.time_system()});
} }
for (auto client = clients.begin(); client != clients.end(); client++) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client->stream->Read(&client_status)); GPR_ASSERT(client->stream->Read(&client_status));
const auto& stats = client_status.stats(); const auto& stats = client_status.stats();
result.latencies.MergeProto(stats.latencies()); result->latencies.MergeProto(stats.latencies());
result.client_resources.push_back(ResourceUsage{ result->client_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()}); stats.time_elapsed(), stats.time_user(), stats.time_system()});
} }
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#ifndef TEST_QPS_DRIVER_H #ifndef TEST_QPS_DRIVER_H
#define TEST_QPS_DRIVER_H #define TEST_QPS_DRIVER_H
#include <memory>
#include "test/cpp/qps/histogram.h" #include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/qpstest.grpc.pb.h"
...@@ -49,15 +51,14 @@ struct ScenarioResult { ...@@ -49,15 +51,14 @@ struct ScenarioResult {
Histogram latencies; Histogram latencies;
std::vector<ResourceUsage> client_resources; std::vector<ResourceUsage> client_resources;
std::vector<ResourceUsage> server_resources; std::vector<ResourceUsage> server_resources;
ClientConfig client_config;
ServerConfig server_config;
}; };
ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config, std::unique_ptr<ScenarioResult> RunScenario(
size_t num_clients, const grpc::testing::ClientConfig& client_config, size_t num_clients,
const grpc::testing::ServerConfig& server_config, const grpc::testing::ServerConfig& server_config, size_t num_servers,
size_t num_servers, int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count);
int warmup_seconds,
int benchmark_seconds,
int spawn_local_worker_count);
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc
......
...@@ -103,14 +103,13 @@ int main(int argc, char** argv) { ...@@ -103,14 +103,13 @@ int main(int argc, char** argv) {
FLAGS_server_threads < FLAGS_client_channels * FLAGS_server_threads < FLAGS_client_channels *
FLAGS_outstanding_rpcs_per_channel)); FLAGS_outstanding_rpcs_per_channel));
auto result = RunScenario(client_config, FLAGS_num_clients, const auto result = RunScenario(
server_config, FLAGS_num_servers, client_config, FLAGS_num_clients, server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers);
FLAGS_local_workers);
ReportQPSPerCore(*result, server_config);
ReportQPSPerCore(result, server_config); ReportLatency(*result);
ReportLatency(result); ReportTimes(*result);
ReportTimes(result);
return 0; return 0;
} }
...@@ -64,8 +64,8 @@ static void RunQPS() { ...@@ -64,8 +64,8 @@ static void RunQPS() {
const auto result = const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
ReportQPSPerCore(result, server_config); ReportQPSPerCore(*result, server_config);
ReportLatency(result); ReportLatency(*result);
} }
} // namespace testing } // namespace testing
......
...@@ -102,6 +102,7 @@ message ClientConfig { ...@@ -102,6 +102,7 @@ message ClientConfig {
// only for async client: // only for async client:
optional int32 async_client_threads = 7; optional int32 async_client_threads = 7;
optional RpcType rpc_type = 8 [default=UNARY]; optional RpcType rpc_type = 8 [default=UNARY];
optional string host = 9;
} }
// Request current stats // Request current stats
...@@ -129,6 +130,7 @@ message ServerConfig { ...@@ -129,6 +130,7 @@ message ServerConfig {
required ServerType server_type = 1; required ServerType server_type = 1;
optional int32 threads = 2 [default=1]; optional int32 threads = 2 [default=1];
optional bool enable_ssl = 3 [default=false]; optional bool enable_ssl = 3 [default=false];
optional string host = 4;
} }
message ServerArgs { message ServerArgs {
......
...@@ -63,8 +63,8 @@ static void RunSynchronousStreamingPingPong() { ...@@ -63,8 +63,8 @@ static void RunSynchronousStreamingPingPong() {
const auto result = const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
ReportQPS(result); ReportQPS(*result);
ReportLatency(result); ReportLatency(*result);
} }
} // namespace testing } // namespace testing
......
...@@ -63,8 +63,8 @@ static void RunSynchronousUnaryPingPong() { ...@@ -63,8 +63,8 @@ static void RunSynchronousUnaryPingPong() {
const auto result = const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
ReportQPS(result); ReportQPS(*result);
ReportLatency(result); ReportLatency(*result);
} }
} // namespace testing } // namespace testing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment