Click here to Skip to main content
15,944,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
I use services Azure Service Bus for transfer data to client, which may be for NAT.
And i send different sized message: 200 byte - often 5-10 kb - medium 200 kb - sometimes

When I send a query that returns only the truth, it takes 290-310 ms. Method:
C#
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
var count = 100;
sw.Start();
for (int i = 0; i < count; i++)
{
    this.client.Ping();
}
sw.Stop();
var average= Convert.ToInt32(sw.ElapsedMilliseconds) / count;


Global settings:

C#
ServicePointManager.UseNagleAlgorithm = false;
System.Net.ServicePointManager.Expect100Continue = false;


Server side:
C#
service = new ServiceHost(typeof(ServerSide));
      var thisBinding = new NetTcpBinding();
      ServicePointManager.UseNagleAlgorithm = false;
      System.Net.ServicePointManager.Expect100Continue = false;
              var uri = ServiceBusEnvironment.CreateServiceUri("sb", this.serviceNamespace, this.servicePath);
              TokenProvider Tp = TokenProvider.CreateSharedSecretTokenProvider(this.secretName, this.secretWord);
              var transportElement = new TransportClientEndpointBehavior(Tp); ServerBinding = new NetTcpRelayBinding();
      ServerBinding.ConnectionMode = TcpRelayConnectionMode.Relayed;
      ServerBinding.Security.Mode = EndToEndSecurityMode.None;
      ServerBinding.TransferMode = TransferMode.Buffered;
      ServerBinding.CloseTimeout = new TimeSpan(10, 10, 0);
      ServerBinding.OpenTimeout = new TimeSpan(10, 10, 0);
      ServerBinding.SendTimeout = new TimeSpan(10, 10, 0);
      ServerBinding.ReceiveTimeout = new TimeSpan(10, 10, 0);
      ServerBinding.MaxBufferPoolSize = int.MaxValue;
      ServerBinding.MaxReceivedMessageSize = int.MaxValue;
      ServerBinding.ReaderQuotas.MaxDepth = int.MaxValue;
      ServerBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
      ServerBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
      ServerBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
      ServerBinding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
      service.CloseTimeout = new TimeSpan(0, 10, 30);
      service.OpenTimeout = new TimeSpan(0, 10, 30);
      service.AddServiceEndpoint(typeof(IServerSide), ServerBinding, uri).Behaviors.Add(transportElement);


Client side:
C#
var ServerBinding = new NetTcpRelayBinding();
ServerBinding.Security.Mode = EndToEndSecurityMode.None;
ServerBinding.ConnectionMode = TcpRelayConnectionMode.Relayed;
ServerBinding.TransferMode = TransferMode.Buffered;
ServerBinding.SendTimeout = new TimeSpan(0, 1, 0);
ServerBinding.OpenTimeout = new TimeSpan(0, 1, 0);
ServerBinding.MaxBufferPoolSize = int.MaxValue;
ServerBinding.MaxReceivedMessageSize = int.MaxValue;
ServerBinding.ReaderQuotas.MaxDepth = int.MaxValue;
ServerBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
ServerBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
ServerBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
ServerBinding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
var cf = new ChannelFactory<IServerSide>(ServerBinding, new EndpointAddress(ServiceBusEnvironment.CreateServiceUri("sb", this.serviceNamespace, this.servicePath)));
cf.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior { TokenProvider = TokenProvider.CreateSharedSecretTokenProvider(this.secretName, this.secretWord) });


What is the normal rate?
As there are ways to speed up the exchange?
And what else can interfere with the service?
Settings are correct and what other settings should I use?

Thanks!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900