views:

221

answers:

4

I have an interesting problem with WCF in a Windows 7 environment... it's slooooooow.

The service is self-hosted, running in a console app.

The same code running in a Vista environment runs in about 1/3 of the time.

Server config:

<system.serviceModel>
 <behaviors>
  <serviceBehaviors>
   <behavior name="Logging.Services.LoggerServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="1000" maxConcurrentInstances="1000" />
    <serviceDebug includeExceptionDetailInFaults="true" />
    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
   </behavior>
  </serviceBehaviors>
 </behaviors>
 <bindings>
  <netTcpBinding>
   <binding name="nettcp" maxBufferSize="524288" maxConnections="1000" maxReceivedMessageSize="524288">
    <security mode="None">
     <transport clientCredentialType="None" protectionLevel="None" />
     <message clientCredentialType="None" />
    </security>
   </binding>
  </netTcpBinding>
 </bindings>
 <services>
  <service behaviorConfiguration="Logging.Services.LoggerServiceBehavior" name="Logging.Services.LoggerService">
   <endpoint address="" binding="netTcpBinding" bindingConfiguration="nettcp"
    name="tcp" contract="Logging.Services.Contracts.ILogger" />
   <host>
    <baseAddresses>
     <add baseAddress="net.tcp://localhost:8001/LoggerService" />
     <add baseAddress="http://localhost:8002/LoggerService" />
    </baseAddresses>
   </host>
  </service>
 </services>
</system.serviceModel>

Client config:

  <netTcpBinding>
   <binding name="tcp" closeTimeout="00:01:00" openTimeout="00:01:00"
    receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
    transferMode="Buffered" transactionProtocol="OleTransactions"
    hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
    maxBufferSize="524288" maxConnections="10" maxReceivedMessageSize="524288">
    <readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="16384"
     maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00"
     enabled="false" />
    <security mode="None">
     <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
     <message clientCredentialType="Windows" />
    </security>     
   </binding>    
  </netTcpBinding>

and

  <endpoint address="net.tcp://localhost:8001/LoggerService" binding="netTcpBinding"
   bindingConfiguration="tcp" contract="LoggerLogService.ILogger"
   name="tcp" />

I read somewhere that someone with a similar problem, running NOD32 had to turn HTTP Checking off, which I have done to no effect. I completely disabled NOD with no luck.

Any ideas?

Thanks in advance!

A: 

Check out WCF Performance Counters to track down where the bottleneck might be occurring.

Mike Atlas
Hi Mike, I am only getting 2 calls per second with a large backlog of calls outstanding. This is for a "one way" service call. Weird...
Quoo
Sounds like something is slowing them down further upstream, perhaps.
Mike Atlas
A: 

from this post try adding the following entry to the binding configuration:

useDefaultWebProxy="false"

EDIT: Since you are using netTCP, try increasing your maxConnections and maxmessagesize

Russ Bradberry
Hi Russ, the useDefaultWebProxy attribute is for HTTP based bindings only afaik.
Quoo
ah, i guess i should pay closer attention
Russ Bradberry
A: 

What is the concurrency mode set to on the service? I'm not sure how to do this through the config file, but on one of my WCF services, I added this ServiceBehaviorAttribute to my service class:

[ServiceBehavior(
    Namespace="http://blah.com/",
    InstanceContextMode = InstanceContextMode.Single, 
    ConcurrencyMode=ConcurrencyMode.Multiple)]
public class MyService : IMyServiceInterface
{
    // ...
}

If your service is already running with concurrency and things are still slow, it may be due to something in the service code itself. Although Vista is 3 times faster, that still sounds incredibly slow, depending on what the service is doing.

Jacob
Thanks Jacob, my service is also a Singleton and has a ConcurrencyMode of Multiple. I did find my problem though, see above.
Quoo
A: 

Meh... apologies guys, I was pointing my repository at my SQL server at work... Would help if I had noticed the 7MB of error logs available the entire time. Sleep deprivation is finally kicking in I think.

Thanks anyway!

Quoo
consider flagging your original post for deletion, perhaps.
Mike Atlas