|
|
@ -149,19 +149,18 @@ std::unique_ptr<ScenarioResult> RunScenario( |
|
|
|
|
|
|
|
|
|
|
|
// Start servers
|
|
|
|
// Start servers
|
|
|
|
using runsc::ServerData; |
|
|
|
using runsc::ServerData; |
|
|
|
vector<ServerData> servers; |
|
|
|
ServerData servers[num_servers]; |
|
|
|
for (size_t i = 0; i < num_servers; i++) { |
|
|
|
for (size_t i = 0; i < num_servers; i++) { |
|
|
|
ServerData sd; |
|
|
|
servers[i].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 = server_config; |
|
|
|
result_server_config.set_host(workers[i]); |
|
|
|
result_server_config.set_host(workers[i]); |
|
|
|
*args.mutable_setup() = server_config; |
|
|
|
*args.mutable_setup() = server_config; |
|
|
|
sd.stream = std::move(sd.stub->RunServer(runsc::AllocContext(&contexts))); |
|
|
|
servers[i].stream = std::move(servers[i].stub->RunServer(runsc::AllocContext(&contexts))); |
|
|
|
GPR_ASSERT(sd.stream->Write(args)); |
|
|
|
GPR_ASSERT(servers[i].stream->Write(args)); |
|
|
|
ServerStatus init_status; |
|
|
|
ServerStatus init_status; |
|
|
|
GPR_ASSERT(sd.stream->Read(&init_status)); |
|
|
|
GPR_ASSERT(servers[i].stream->Read(&init_status)); |
|
|
|
char* host; |
|
|
|
char* host; |
|
|
|
char* driver_port; |
|
|
|
char* driver_port; |
|
|
|
char* cli_target; |
|
|
|
char* cli_target; |
|
|
@ -171,27 +170,22 @@ std::unique_ptr<ScenarioResult> RunScenario( |
|
|
|
gpr_free(host); |
|
|
|
gpr_free(host); |
|
|
|
gpr_free(driver_port); |
|
|
|
gpr_free(driver_port); |
|
|
|
gpr_free(cli_target); |
|
|
|
gpr_free(cli_target); |
|
|
|
|
|
|
|
|
|
|
|
servers.push_back(std::move(sd)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Start clients
|
|
|
|
// Start clients
|
|
|
|
using runsc::ClientData; |
|
|
|
using runsc::ClientData; |
|
|
|
vector<ClientData> clients; |
|
|
|
ClientData clients[num_clients]; |
|
|
|
for (size_t i = 0; i < num_clients; i++) { |
|
|
|
for (size_t i = 0; i < num_clients; i++) { |
|
|
|
ClientData cd; |
|
|
|
clients[i].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 = client_config; |
|
|
|
result_client_config.set_host(workers[i + num_servers]); |
|
|
|
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(runsc::AllocContext(&contexts))); |
|
|
|
clients[i].stream = std::move(clients[i].stub->RunTest(runsc::AllocContext(&contexts))); |
|
|
|
GPR_ASSERT(cd.stream->Write(args)); |
|
|
|
GPR_ASSERT(clients[i].stream->Write(args)); |
|
|
|
ClientStatus init_status; |
|
|
|
ClientStatus init_status; |
|
|
|
GPR_ASSERT(cd.stream->Read(&init_status)); |
|
|
|
GPR_ASSERT(clients[i].stream->Read(&init_status)); |
|
|
|
|
|
|
|
|
|
|
|
clients.push_back(std::move(cd)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Let everything warmup
|
|
|
|
// Let everything warmup
|
|
|
@ -206,18 +200,18 @@ std::unique_ptr<ScenarioResult> RunScenario( |
|
|
|
server_mark.mutable_mark(); |
|
|
|
server_mark.mutable_mark(); |
|
|
|
ClientArgs client_mark; |
|
|
|
ClientArgs client_mark; |
|
|
|
client_mark.mutable_mark(); |
|
|
|
client_mark.mutable_mark(); |
|
|
|
for (auto server = servers.begin(); server != servers.end(); server++) { |
|
|
|
for (auto server = &servers[0]; server != &servers[num_servers]; server++) { |
|
|
|
GPR_ASSERT(server->stream->Write(server_mark)); |
|
|
|
GPR_ASSERT(server->stream->Write(server_mark)); |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto client = clients.begin(); client != clients.end(); client++) { |
|
|
|
for (auto client = &clients[0]; client != &clients[num_clients]; client++) { |
|
|
|
GPR_ASSERT(client->stream->Write(client_mark)); |
|
|
|
GPR_ASSERT(client->stream->Write(client_mark)); |
|
|
|
} |
|
|
|
} |
|
|
|
ServerStatus server_status; |
|
|
|
ServerStatus server_status; |
|
|
|
ClientStatus client_status; |
|
|
|
ClientStatus client_status; |
|
|
|
for (auto server = servers.begin(); server != servers.end(); server++) { |
|
|
|
for (auto server = &servers[0]; server != &servers[num_servers]; server++) { |
|
|
|
GPR_ASSERT(server->stream->Read(&server_status)); |
|
|
|
GPR_ASSERT(server->stream->Read(&server_status)); |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto client = clients.begin(); client != clients.end(); client++) { |
|
|
|
for (auto client = &clients[0]; client != &clients[num_clients]; client++) { |
|
|
|
GPR_ASSERT(client->stream->Read(&client_status)); |
|
|
|
GPR_ASSERT(client->stream->Read(&client_status)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -231,19 +225,19 @@ std::unique_ptr<ScenarioResult> RunScenario( |
|
|
|
result->client_config = result_client_config; |
|
|
|
result->client_config = result_client_config; |
|
|
|
result->server_config = result_server_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[0]; server != &servers[num_servers]; server++) { |
|
|
|
GPR_ASSERT(server->stream->Write(server_mark)); |
|
|
|
GPR_ASSERT(server->stream->Write(server_mark)); |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto client = clients.begin(); client != clients.end(); client++) { |
|
|
|
for (auto client = &clients[0]; client != &clients[num_clients]; client++) { |
|
|
|
GPR_ASSERT(client->stream->Write(client_mark)); |
|
|
|
GPR_ASSERT(client->stream->Write(client_mark)); |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto server = servers.begin(); server != servers.end(); server++) { |
|
|
|
for (auto server = &servers[0]; server != &servers[num_servers]; 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.emplace_back( |
|
|
|
result->server_resources.emplace_back( |
|
|
|
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[0]; client != &clients[num_clients]; 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()); |
|
|
@ -251,11 +245,11 @@ std::unique_ptr<ScenarioResult> RunScenario( |
|
|
|
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[0]; client != &clients[num_clients]; client++) { |
|
|
|
GPR_ASSERT(client->stream->WritesDone()); |
|
|
|
GPR_ASSERT(client->stream->WritesDone()); |
|
|
|
GPR_ASSERT(client->stream->Finish().ok()); |
|
|
|
GPR_ASSERT(client->stream->Finish().ok()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto server = servers.begin(); server != servers.end(); server++) { |
|
|
|
for (auto server = &servers[0]; server != &servers[num_servers]; server++) { |
|
|
|
GPR_ASSERT(server->stream->WritesDone()); |
|
|
|
GPR_ASSERT(server->stream->WritesDone()); |
|
|
|
GPR_ASSERT(server->stream->Finish().ok()); |
|
|
|
GPR_ASSERT(server->stream->Finish().ok()); |
|
|
|
} |
|
|
|
} |
|
|
|