2009-11-11 63 views
0

在Windows 7环境中,我有一个有趣的WCF问题......它是slooooooow。Windows 7上的WCF性能

该服务是自托管的,在控制台应用程序中运行。

运行在Vista环境中的相同代码在大约1/3时间内运行。

服务器配置:

<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> 

客户端配置:

 <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> 

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

我读的地方,有人用类似的问题,运行NOD32不得不把HTTP检查关闭,我做了没有效果。我完全禁用NOD,但没有运气。

任何想法?

在此先感谢!

回答

0

呃......道歉的人,我在工作时将我的存储库指向我的SQL服务器......如果我注意到整个7MB的错误日志可用,会有所帮助。我认为睡眠剥夺终于在踢。

还是要谢谢你!

+1

可能考虑将您的原始帖子标记为删除。 – 2009-11-12 16:07:49

1

查看WCF Performance Counters查找可能发生瓶颈的位置。

+0

嗨迈克,我只有每秒接到2个呼叫,并且有大量未完成的呼叫。这是为了“单向”服务呼叫。奇怪... – 2009-11-11 23:53:45

+0

听起来像某种东西正在放慢他们的上游,也许。 – 2009-11-12 00:00:26

0

this post尝试添加以下条目绑定配置:

useDefaultWebProxy = “假”

编辑: 由于您使用netTCP,尝试增加MAXCONNECTIONS和maxmessagesize

+0

嗨Russ,useDefaultWebProxy属性仅用于基于HTTP的绑定afaik。 – 2009-11-11 23:47:57

+0

啊,我想我应该更加关注 – 2009-11-11 23:58:53

0

什么是在服务上设置的并发模式?我不知道如何通过配置文件做到这一点,但我的WCF服务之一,我加入这个ServiceBehaviorAttribute我的服务类:

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

如果您的服务已并发运行,事情仍速度慢,这可能是由于服务代码本身的问题。尽管Vista速度提高了3倍,但这听起来仍然非常慢,取决于服务的效果。

+0

谢谢Jacob,我的服务也是一个Singleton,并且有一个Multiple的并发模式。我确实发现了我的问题,请参阅上文。 – 2009-11-12 00:43:03