2009-11-11 60 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