From 90dd32708bfc51c11182033c17b8409312e320f6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Nov 2015 15:31:53 -0800 Subject: [PATCH 1/4] polish benchmark protos --- test/proto/benchmarks/control.proto | 2 ++ test/proto/benchmarks/stats.proto | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/proto/benchmarks/control.proto b/test/proto/benchmarks/control.proto index 966ab78baae..962bd2f8cc3 100644 --- a/test/proto/benchmarks/control.proto +++ b/test/proto/benchmarks/control.proto @@ -97,6 +97,7 @@ message ClientConfig { RpcType rpc_type = 8; LoadParams load_params = 10; PayloadConfig payload_config = 11; + HistogramParams histogram_params = 12; } message ClientStatus { @@ -118,6 +119,7 @@ message ClientArgs { message ServerConfig { ServerType server_type = 1; SecurityParams security_params = 2; + string host = 3; int32 port = 4; // only for async server int32 async_server_threads = 7; diff --git a/test/proto/benchmarks/stats.proto b/test/proto/benchmarks/stats.proto index d52144f3214..71b085977db 100644 --- a/test/proto/benchmarks/stats.proto +++ b/test/proto/benchmarks/stats.proto @@ -32,16 +32,24 @@ syntax = "proto3"; package grpc.testing; message ServerStats { - // wall clock time + // wall clock time change since last reset double time_elapsed = 1; - // user time used by the server process and threads + // change in user time used by the server since last reset double time_user = 2; - // server time used by the server process and all threads + // change in server time used by the server process and all threads since + // last reset double time_system = 3; } +// Histogram params based on grpc/support/histogram.c +message HistogramParams { + double resolution = 1; // first bucket is [0, 1 + resolution) + double max_possible = 2; // use enough buckets to allow this value +} + +// Histogram data based on grpc/support/histogram.c message HistogramData { repeated uint32 bucket = 1; double min_seen = 2; @@ -53,6 +61,8 @@ message HistogramData { message ClientStats { HistogramData latencies = 1; + + // See ServerStats for details. double time_elapsed = 2; double time_user = 3; double time_system = 4; From 4d7dbbfcbcd19cc5deac0c2371fa8ffc267d74de Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Nov 2015 15:32:26 -0800 Subject: [PATCH 2/4] regenerate protos --- src/csharp/Grpc.IntegrationTesting/Control.cs | 102 +++++++++--- src/csharp/Grpc.IntegrationTesting/Stats.cs | 148 ++++++++++++++++-- 2 files changed, 220 insertions(+), 30 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 101f6cce91f..4764e1072bd 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -36,7 +36,7 @@ namespace Grpc.Testing { "cGMudGVzdGluZy5EZXRlcm1pbmlzdGljUGFyYW1zSAASLAoGcGFyZXRvGAUg", "ASgLMhouZ3JwYy50ZXN0aW5nLlBhcmV0b1BhcmFtc0gAQgYKBGxvYWQiQwoO", "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", - "X2hvc3Rfb3ZlcnJpZGUYAiABKAki9gIKDENsaWVudENvbmZpZxIWCg5zZXJ2", + "X2hvc3Rfb3ZlcnJpZGUYAiABKAkirwMKDENsaWVudENvbmZpZxIWCg5zZXJ2", "ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu", "dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc", "LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y", @@ -44,24 +44,26 @@ namespace Grpc.Testing { "BRIcChRhc3luY19jbGllbnRfdGhyZWFkcxgHIAEoBRInCghycGNfdHlwZRgI", "IAEoDjIVLmdycGMudGVzdGluZy5ScGNUeXBlEi0KC2xvYWRfcGFyYW1zGAog", "ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m", - "aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZyI4CgxDbGll", - "bnRTdGF0dX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EAEqLwoKU2VydmVyVHlwZRIPCgtTWU5DX1NFUlZFUhAAEhAKDEFT", + "WU5DX1NFUlZFUhABKiMKB1JwY1R5cGUSCQoFVU5BUlkQABINCglTVFJFQU1J", + "TkcQAWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.Payloads.Descriptor, global::Grpc.Testing.Stats.Descriptor, }, new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedCodeInfo[] { @@ -72,11 +74,11 @@ namespace Grpc.Testing { new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), null, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), new[]{ "ClosedLoop", "Poisson", "Uniform", "Determ", "Pareto" }, new[]{ "Load" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), new[]{ "Stats" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), new[]{ "Reset" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), new[]{ "ServerType", "SecurityParams", "Host", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), new[]{ "Stats", "Port", "Cores" }, null, null, null) })); @@ -1062,6 +1064,7 @@ namespace Grpc.Testing { rpcType_ = other.rpcType_; LoadParams = other.loadParams_ != null ? other.LoadParams.Clone() : null; PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null; + HistogramParams = other.histogramParams_ != null ? other.HistogramParams.Clone() : null; } public ClientConfig Clone() { @@ -1148,6 +1151,15 @@ namespace Grpc.Testing { } } + public const int HistogramParamsFieldNumber = 12; + private global::Grpc.Testing.HistogramParams histogramParams_; + public global::Grpc.Testing.HistogramParams HistogramParams { + get { return histogramParams_; } + set { + histogramParams_ = value; + } + } + public override bool Equals(object other) { return Equals(other as ClientConfig); } @@ -1168,6 +1180,7 @@ namespace Grpc.Testing { if (RpcType != other.RpcType) return false; if (!object.Equals(LoadParams, other.LoadParams)) return false; if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false; + if (!object.Equals(HistogramParams, other.HistogramParams)) return false; return true; } @@ -1182,6 +1195,7 @@ namespace Grpc.Testing { if (RpcType != global::Grpc.Testing.RpcType.UNARY) hash ^= RpcType.GetHashCode(); if (loadParams_ != null) hash ^= LoadParams.GetHashCode(); if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode(); + if (histogramParams_ != null) hash ^= HistogramParams.GetHashCode(); return hash; } @@ -1223,6 +1237,10 @@ namespace Grpc.Testing { output.WriteRawTag(90); output.WriteMessage(PayloadConfig); } + if (histogramParams_ != null) { + output.WriteRawTag(98); + output.WriteMessage(HistogramParams); + } } public int CalculateSize() { @@ -1252,6 +1270,9 @@ namespace Grpc.Testing { if (payloadConfig_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(PayloadConfig); } + if (histogramParams_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HistogramParams); + } return size; } @@ -1293,6 +1314,12 @@ namespace Grpc.Testing { } PayloadConfig.MergeFrom(other.PayloadConfig); } + if (other.histogramParams_ != null) { + if (histogramParams_ == null) { + histogramParams_ = new global::Grpc.Testing.HistogramParams(); + } + HistogramParams.MergeFrom(other.HistogramParams); + } } public void MergeFrom(pb::CodedInputStream input) { @@ -1347,6 +1374,13 @@ namespace Grpc.Testing { input.ReadMessage(payloadConfig_); break; } + case 98: { + if (histogramParams_ == null) { + histogramParams_ = new global::Grpc.Testing.HistogramParams(); + } + input.ReadMessage(histogramParams_); + break; + } } } } @@ -1749,6 +1783,7 @@ namespace Grpc.Testing { public ServerConfig(ServerConfig other) : this() { serverType_ = other.serverType_; SecurityParams = other.securityParams_ != null ? other.SecurityParams.Clone() : null; + host_ = other.host_; port_ = other.port_; asyncServerThreads_ = other.asyncServerThreads_; coreLimit_ = other.coreLimit_; @@ -1777,6 +1812,15 @@ namespace Grpc.Testing { } } + public const int HostFieldNumber = 3; + private string host_ = ""; + public string Host { + get { return host_; } + set { + host_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + public const int PortFieldNumber = 4; private int port_; public int Port { @@ -1826,6 +1870,7 @@ namespace Grpc.Testing { } if (ServerType != other.ServerType) return false; if (!object.Equals(SecurityParams, other.SecurityParams)) return false; + if (Host != other.Host) return false; if (Port != other.Port) return false; if (AsyncServerThreads != other.AsyncServerThreads) return false; if (CoreLimit != other.CoreLimit) return false; @@ -1837,6 +1882,7 @@ namespace Grpc.Testing { int hash = 1; if (ServerType != global::Grpc.Testing.ServerType.SYNC_SERVER) hash ^= ServerType.GetHashCode(); if (securityParams_ != null) hash ^= SecurityParams.GetHashCode(); + if (Host.Length != 0) hash ^= Host.GetHashCode(); if (Port != 0) hash ^= Port.GetHashCode(); if (AsyncServerThreads != 0) hash ^= AsyncServerThreads.GetHashCode(); if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); @@ -1857,6 +1903,10 @@ namespace Grpc.Testing { output.WriteRawTag(18); output.WriteMessage(SecurityParams); } + if (Host.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Host); + } if (Port != 0) { output.WriteRawTag(32); output.WriteInt32(Port); @@ -1883,6 +1933,9 @@ namespace Grpc.Testing { if (securityParams_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SecurityParams); } + if (Host.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Host); + } if (Port != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); } @@ -1911,6 +1964,9 @@ namespace Grpc.Testing { } SecurityParams.MergeFrom(other.SecurityParams); } + if (other.Host.Length != 0) { + Host = other.Host; + } if (other.Port != 0) { Port = other.Port; } @@ -1946,6 +2002,10 @@ namespace Grpc.Testing { input.ReadMessage(securityParams_); break; } + case 26: { + Host = input.ReadString(); + break; + } case 32: { Port = input.ReadInt32(); break; diff --git a/src/csharp/Grpc.IntegrationTesting/Stats.cs b/src/csharp/Grpc.IntegrationTesting/Stats.cs index 8165e926884..4ae66baffa5 100644 --- a/src/csharp/Grpc.IntegrationTesting/Stats.cs +++ b/src/csharp/Grpc.IntegrationTesting/Stats.cs @@ -23,17 +23,19 @@ namespace Grpc.Testing { string.Concat( "CiF0ZXN0L3Byb3RvL2JlbmNobWFya3Mvc3RhdHMucHJvdG8SDGdycGMudGVz", "dGluZyJLCgtTZXJ2ZXJTdGF0cxIUCgx0aW1lX2VsYXBzZWQYASABKAESEQoJ", - "dGltZV91c2VyGAIgASgBEhMKC3RpbWVfc3lzdGVtGAMgASgBIncKDUhpc3Rv", - "Z3JhbURhdGESDgoGYnVja2V0GAEgAygNEhAKCG1pbl9zZWVuGAIgASgBEhAK", - "CG1heF9zZWVuGAMgASgBEgsKA3N1bRgEIAEoARIWCg5zdW1fb2Zfc3F1YXJl", - "cxgFIAEoARINCgVjb3VudBgGIAEoASJ7CgtDbGllbnRTdGF0cxIuCglsYXRl", - "bmNpZXMYASABKAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIUCgx0", - "aW1lX2VsYXBzZWQYAiABKAESEQoJdGltZV91c2VyGAMgASgBEhMKC3RpbWVf", - "c3lzdGVtGAQgASgBYgZwcm90bzM=")); + "dGltZV91c2VyGAIgASgBEhMKC3RpbWVfc3lzdGVtGAMgASgBIjsKD0hpc3Rv", + "Z3JhbVBhcmFtcxISCgpyZXNvbHV0aW9uGAEgASgBEhQKDG1heF9wb3NzaWJs", + "ZRgCIAEoASJ3Cg1IaXN0b2dyYW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQCght", + "aW5fc2VlbhgCIAEoARIQCghtYXhfc2VlbhgDIAEoARILCgNzdW0YBCABKAES", + "FgoOc3VtX29mX3NxdWFyZXMYBSABKAESDQoFY291bnQYBiABKAEiewoLQ2xp", + "ZW50U3RhdHMSLgoJbGF0ZW5jaWVzGAEgASgLMhsuZ3JwYy50ZXN0aW5nLkhp", + "c3RvZ3JhbURhdGESFAoMdGltZV9lbGFwc2VkGAIgASgBEhEKCXRpbWVfdXNl", + "chgDIAEoARITCgt0aW1lX3N5c3RlbRgEIAEoAWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStats), new[]{ "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramParams), new[]{ "Resolution", "MaxPossible" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramData), new[]{ "Bucket", "MinSeen", "MaxSeen", "Sum", "SumOfSquares", "Count" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStats), new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null) })); @@ -196,13 +198,141 @@ namespace Grpc.Testing { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class HistogramParams : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HistogramParams()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[1]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public HistogramParams() { + OnConstruction(); + } + + partial void OnConstruction(); + + public HistogramParams(HistogramParams other) : this() { + resolution_ = other.resolution_; + maxPossible_ = other.maxPossible_; + } + + public HistogramParams Clone() { + return new HistogramParams(this); + } + + public const int ResolutionFieldNumber = 1; + private double resolution_; + public double Resolution { + get { return resolution_; } + set { + resolution_ = value; + } + } + + public const int MaxPossibleFieldNumber = 2; + private double maxPossible_; + public double MaxPossible { + get { return maxPossible_; } + set { + maxPossible_ = value; + } + } + + public override bool Equals(object other) { + return Equals(other as HistogramParams); + } + + public bool Equals(HistogramParams other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Resolution != other.Resolution) return false; + if (MaxPossible != other.MaxPossible) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (Resolution != 0D) hash ^= Resolution.GetHashCode(); + if (MaxPossible != 0D) hash ^= MaxPossible.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (Resolution != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Resolution); + } + if (MaxPossible != 0D) { + output.WriteRawTag(17); + output.WriteDouble(MaxPossible); + } + } + + public int CalculateSize() { + int size = 0; + if (Resolution != 0D) { + size += 1 + 8; + } + if (MaxPossible != 0D) { + size += 1 + 8; + } + return size; + } + + public void MergeFrom(HistogramParams other) { + if (other == null) { + return; + } + if (other.Resolution != 0D) { + Resolution = other.Resolution; + } + if (other.MaxPossible != 0D) { + MaxPossible = other.MaxPossible; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + Resolution = input.ReadDouble(); + break; + } + case 17: { + MaxPossible = input.ReadDouble(); + break; + } + } + } + } + + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class HistogramData : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HistogramData()); public static pb::MessageParser Parser { get { return _parser; } } public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[1]; } + get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[2]; } } pbr::MessageDescriptor pb::IMessage.Descriptor { @@ -427,7 +557,7 @@ namespace Grpc.Testing { public static pb::MessageParser Parser { get { return _parser; } } public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[2]; } + get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[3]; } } pbr::MessageDescriptor pb::IMessage.Descriptor { From 18ce9d65ef8ee34f31fb9e5fd82718247061ad2a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Nov 2015 15:41:10 -0800 Subject: [PATCH 3/4] use new proto option in C# --- .../Grpc.IntegrationTesting/ClientRunners.cs | 14 +++++++++----- .../RunnerClientServerTest.cs | 8 +++++++- .../Grpc.IntegrationTesting/ServerRunners.cs | 2 +- test/proto/benchmarks/stats.proto | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs index aa0455c0897..e9e659cb1fb 100644 --- a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs +++ b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs @@ -66,7 +66,9 @@ namespace Grpc.IntegrationTesting switch (config.RpcType) { case RpcType.UNARY: - return new SyncUnaryClientRunner(channel, config.PayloadConfig.SimpleParams.ReqSize); + return new SyncUnaryClientRunner(channel, + config.PayloadConfig.SimpleParams.ReqSize, + config.HistogramParams); case RpcType.STREAMING: default: @@ -80,6 +82,8 @@ namespace Grpc.IntegrationTesting /// public class SyncUnaryClientRunner : IClientRunner { + const double SecondsToNanos = 1e9; + readonly Channel channel; readonly int payloadSize; readonly Histogram histogram; @@ -89,11 +93,11 @@ namespace Grpc.IntegrationTesting readonly CancellationTokenSource stoppedCts; readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); - public SyncUnaryClientRunner(Channel channel, int payloadSize) + public SyncUnaryClientRunner(Channel channel, int payloadSize, HistogramParams histogramParams) { this.channel = Grpc.Core.Utils.Preconditions.CheckNotNull(channel); this.payloadSize = payloadSize; - this.histogram = new Histogram(0.01, 60e9); // TODO: needs to be in sync with test/cpp/qps/histogram.h + this.histogram = new Histogram(histogramParams.Resolution, histogramParams.MaxPossible); this.stoppedCts = new CancellationTokenSource(); this.client = BenchmarkService.NewClient(channel); @@ -136,8 +140,8 @@ namespace Grpc.IntegrationTesting client.UnaryCall(request); stopwatch.Stop(); - // TODO: 1e9 needs to be in sync with C++ code - histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * 1e9); + // spec requires data point in nanoseconds. + histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos); } } diff --git a/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs index 33e0f247196..2b51526c88f 100644 --- a/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs @@ -57,6 +57,7 @@ namespace Grpc.IntegrationTesting var serverConfig = new ServerConfig { ServerType = ServerType.ASYNC_SERVER, + Host = Host, PayloadConfig = new PayloadConfig { SimpleParams = new SimpleProtoParams @@ -90,6 +91,11 @@ namespace Grpc.IntegrationTesting { ReqSize = 100 } + }, + HistogramParams = new HistogramParams + { + Resolution = 0.01, + MaxPossible = 60e9 } }; @@ -105,7 +111,7 @@ namespace Grpc.IntegrationTesting await runner.StopAsync(); System.Console.WriteLine(stats); - System.Console.WriteLine("avg micros/call " + (long) ((stats.Latencies.Sum / stats.Latencies.Count) * 1000000)); + System.Console.WriteLine("avg micros/call " + (long) (stats.Latencies.Sum / stats.Latencies.Count / 1000.0)); } } } diff --git a/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs b/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs index a60d60259bc..e8be7758cee 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs @@ -65,7 +65,7 @@ namespace Grpc.IntegrationTesting var server = new Server { Services = { BenchmarkService.BindService(new BenchmarkServiceImpl(responseSize)) }, - Ports = { new ServerPort("0.0.0.0", config.Port, credentials) } + Ports = { new ServerPort(config.Host, config.Port, credentials) } }; server.Start(); diff --git a/test/proto/benchmarks/stats.proto b/test/proto/benchmarks/stats.proto index 71b085977db..194db47caa5 100644 --- a/test/proto/benchmarks/stats.proto +++ b/test/proto/benchmarks/stats.proto @@ -60,6 +60,7 @@ message HistogramData { } message ClientStats { + // Latency histogram. Data points are in nanoseconds. HistogramData latencies = 1; // See ServerStats for details. From c5ebbd5b8f401778c07277acca0a97701fa17651 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Nov 2015 16:50:47 -0800 Subject: [PATCH 4/4] use new perf proto options in c++ --- test/cpp/qps/async_streaming_ping_pong_test.cc | 1 + test/cpp/qps/async_unary_ping_pong_test.cc | 1 + test/cpp/qps/driver.cc | 2 +- test/cpp/qps/histogram.h | 7 ++++++- test/cpp/qps/qps_driver.cc | 6 ++++++ test/cpp/qps/qps_openloop_test.cc | 1 + test/cpp/qps/qps_test.cc | 1 + test/cpp/qps/qps_test_with_poll.cc | 1 + test/cpp/qps/secure_sync_unary_ping_pong_test.cc | 1 + test/cpp/qps/server_async.cc | 2 +- test/cpp/qps/server_sync.cc | 2 +- test/cpp/qps/sync_streaming_ping_pong_test.cc | 1 + test/cpp/qps/sync_unary_ping_pong_test.cc | 1 + 13 files changed, 23 insertions(+), 4 deletions(-) diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc index 9fef93a70fd..0acdf3affb3 100644 --- a/test/cpp/qps/async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/async_streaming_ping_pong_test.cc @@ -58,6 +58,7 @@ static void RunAsyncStreamingPingPong() { ServerConfig server_config; server_config.set_server_type(ASYNC_SERVER); + server_config.set_host("localhost"); server_config.set_async_server_threads(1); const auto result = diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc index b4ab0e5d595..d21e116171a 100644 --- a/test/cpp/qps/async_unary_ping_pong_test.cc +++ b/test/cpp/qps/async_unary_ping_pong_test.cc @@ -58,6 +58,7 @@ static void RunAsyncUnaryPingPong() { ServerConfig server_config; server_config.set_server_type(ASYNC_SERVER); + server_config.set_host("localhost"); server_config.set_async_server_threads(1); const auto result = diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 2c6247deea1..6f84af1dc08 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -110,7 +110,7 @@ std::unique_ptr RunScenario( list contexts; // To be added to the result, containing the final configuration used for - // client and config (incluiding host, etc.) + // client and config (including host, etc.) ClientConfig result_client_config; ServerConfig result_server_config; diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index 35527d2a2cb..b45c769a779 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -42,7 +42,9 @@ namespace testing { class Histogram { public: - Histogram() : impl_(gpr_histogram_create(0.01, 60e9)) {} + // TODO: look into making histogram params not hardcoded for C++ + Histogram() : impl_(gpr_histogram_create(default_resolution(), + default_max_possible())) {} ~Histogram() { if (impl_) gpr_histogram_destroy(impl_); } @@ -73,6 +75,9 @@ class Histogram { p.sum_of_squares(), p.count()); } + static double default_resolution() { return 0.01; } + static double default_max_possible() { return 60e9; } + private: Histogram(const Histogram&); Histogram& operator=(const Histogram&); diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index 4c93a042cf5..0479e1aff4b 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -137,8 +137,14 @@ static void QpsDriver() { // No further load parameters to set up for closed loop } + client_config.mutable_histogram_params()-> + set_resolution(Histogram::default_resolution()); + client_config.mutable_histogram_params()-> + set_max_possible(Histogram::default_max_possible()); + ServerConfig server_config; server_config.set_server_type(server_type); + server_config.set_host("localhost"); server_config.set_async_server_threads(FLAGS_async_server_threads); if (FLAGS_secure_test) { diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index dc88c893bb9..51df79ef2f3 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -59,6 +59,7 @@ static void RunQPS() { ServerConfig server_config; server_config.set_server_type(ASYNC_SERVER); + server_config.set_host("localhost"); server_config.set_async_server_threads(4); const auto result = diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index 89b35cfb052..1f87d181374 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -58,6 +58,7 @@ static void RunQPS() { ServerConfig server_config; server_config.set_server_type(ASYNC_SERVER); + server_config.set_host("localhost"); server_config.set_async_server_threads(8); const auto result = diff --git a/test/cpp/qps/qps_test_with_poll.cc b/test/cpp/qps/qps_test_with_poll.cc index 97da4096ed3..dc800092db9 100644 --- a/test/cpp/qps/qps_test_with_poll.cc +++ b/test/cpp/qps/qps_test_with_poll.cc @@ -62,6 +62,7 @@ static void RunQPS() { ServerConfig server_config; server_config.set_server_type(ASYNC_SERVER); + server_config.set_host("localhost"); server_config.set_async_server_threads(4); const auto result = diff --git a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc index df06f7e471f..ce9f02cceb2 100644 --- a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc @@ -57,6 +57,7 @@ static void RunSynchronousUnaryPingPong() { ServerConfig server_config; server_config.set_server_type(SYNC_SERVER); + server_config.set_host("localhost"); // Set up security params SecurityParams security; diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 2d922fa6150..c151918ce4c 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -60,7 +60,7 @@ class AsyncQpsServerTest : public Server { explicit AsyncQpsServerTest(const ServerConfig &config) : Server(config) { char *server_address = NULL; - gpr_join_host_port(&server_address, "::", port()); + gpr_join_host_port(&server_address, config.host().c_str(), port()); ServerBuilder builder; builder.AddListeningPort(server_address, diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index a09b174b7e0..3a15bec888d 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -89,7 +89,7 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server { char* server_address = NULL; - gpr_join_host_port(&server_address, "::", port()); + gpr_join_host_port(&server_address, config.host().c_str(), port()); builder.AddListeningPort(server_address, Server::CreateServerCredentials(config)); gpr_free(server_address); diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index 186afc03f7c..dd8c682815c 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc @@ -57,6 +57,7 @@ static void RunSynchronousStreamingPingPong() { ServerConfig server_config; server_config.set_server_type(SYNC_SERVER); + server_config.set_host("localhost"); const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc index 25851833a6d..2edb33ef014 100644 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/sync_unary_ping_pong_test.cc @@ -57,6 +57,7 @@ static void RunSynchronousUnaryPingPong() { ServerConfig server_config; server_config.set_server_type(SYNC_SERVER); + server_config.set_host("localhost"); const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);