From 5c123fd22b06ddf16d3abea3983d3c998d758bfe Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 28 Apr 2016 20:48:24 -0700 Subject: [PATCH 1/2] Add a shard channel arg to client channel construction C core automatically shares subchannels between channels. Therefore our multiple channel performance tests were really testing single channel performance. --- test/cpp/qps/client.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 5a9027a4a23..63fc3156e51 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -280,7 +281,7 @@ class ClientImpl : public Client { create_stub_(create_stub) { for (int i = 0; i < config.client_channels(); i++) { channels_[i].init(config.server_targets(i % config.server_targets_size()), - config, create_stub_); + config, create_stub_, i); } ClientRequestCreator create_req(&request_, @@ -303,14 +304,16 @@ class ClientImpl : public Client { } void init(const grpc::string& target, const ClientConfig& config, std::function(std::shared_ptr)> - create_stub) { + create_stub, int shard) { // We have to use a 2-phase init like this with a default // constructor followed by an initializer function to make // old compilers happy with using this in std::vector + ChannelArguments args; + args.SetInt("shard", shard); channel_ = CreateTestChannel( target, config.security_params().server_host_override(), config.has_security_params(), - !config.security_params().use_test_ca()); + !config.security_params().use_test_ca(), std::shared_ptr(), args); stub_ = create_stub(channel_); } Channel* get_channel() { return channel_.get(); } From 97244d5810e2b0c2b5733094d46d13a061a94424 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 29 Apr 2016 08:05:57 -0700 Subject: [PATCH 2/2] clang-format, make code more self-documenting --- test/cpp/qps/client.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 63fc3156e51..175529f01b2 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -39,8 +39,8 @@ #include #include -#include #include +#include #include #include @@ -304,16 +304,17 @@ class ClientImpl : public Client { } void init(const grpc::string& target, const ClientConfig& config, std::function(std::shared_ptr)> - create_stub, int shard) { + create_stub, + int shard) { // We have to use a 2-phase init like this with a default // constructor followed by an initializer function to make // old compilers happy with using this in std::vector ChannelArguments args; - args.SetInt("shard", shard); + args.SetInt("shard_to_ensure_no_subchannel_merges", shard); channel_ = CreateTestChannel( target, config.security_params().server_host_override(), - config.has_security_params(), - !config.security_params().use_test_ca(), std::shared_ptr(), args); + config.has_security_params(), !config.security_params().use_test_ca(), + std::shared_ptr(), args); stub_ = create_stub(channel_); } Channel* get_channel() { return channel_.get(); }