开发者

WCF not using all cores with Visual Studio 2010 Load Testing

I've developed a WCF service, and I'm testing it for performance using Visual Studio 2010 Load Testing infrastructure. I have a Quad Core Intel Q6600 on my desktop and, for now, the WCF is hosted on a console application for testing purpose. While executing the tests, I have 1 core at 100%, and the other 3 between 25 to 60%. The HostApplication.exe process for only brief instances passes 25%, and I don't know why. Why isn't WCF spreading the calls to the other cores, so that I don't have a CPU bottleneck? Shouldn't I have the HostApplication.exe spread over more than 1 core, limited at 25%?

I have configures VS2010 Load Testing with 25 users, and they are calling 2 methods. On the service implementation of the Methods I use, I have the following configured for ServiceBehaviour:

  [ServiceBehavior(TransactionIsolationLevel = System.Transactions.IsolationLevel.ReadCommitted, 
    InstanceContextMode=InstanceContextMode.PerCall, ConcurrencyMode=ConcurrencyMode.Multiple, ReleaseServiceInstanceOnTransactionComplete=false)]

I've also defined the serviceThrottling behaviour for the service. Below is my app.config:

  <system.serviceModel>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <bindings>
            <basicHttpBinding>
                <binding name="SimpleBinding" />
            </basicHttpBinding>
            <netTcpBinding>
              <binding name="DefaultTCPBinding" closeTimeout="01:00:00" receiveTimeout="01:00:00"
                    sendTimeout="01:00:00" transactionFlow="true" transactionProtocol="OleTransactions"
                    maxBufferSize="5242880" maxReceivedMessageSize="5242880">
                <reliableSession inactivityTimeout="01:00:00" />
              </binding>
            </netTcpBinding>
            <webHttpBinding>
                <binding name="ScriptBindig" crossDomainScriptAccessEnabled="true" />
            </webHttpBinding>
        </bindings>
        <behaviors>
              <endpointBehaviors>
                    <behavior name="WebScriptBehavior">
                          <enableWebScript />
                    </behavior>
              </endpointBehaviors>
              <serviceBehaviors>
                    <behavior name="MetadataBehavior">
                          <serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
                                httpGetBindingConfiguration="" />
                          <serviceDebug includeExceptionDetailInFaults="true" />
                          <serviceThrottling maxConcurrentCalls="64" maxConcurrentSessions="400"
                                maxConcurrentInstances="464" /&g开发者_开发知识库t;
                    </behavior>
              </serviceBehaviors>
        </behaviors>
        <services>
              <service behaviorConfiguration="MetadataBehavior" name="Implementation.TestingAppImplementation">
                    <endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
                          name="TestingAppTCPEndpoint" contract="Interfaces.ITestingApp" />
                    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                          name="TestingAppMex" contract="IMetadataExchange" />
                    <endpoint address="ws" behaviorConfiguration="" binding="basicHttpBinding"
                          bindingConfiguration="SimpleBinding" name="TestingApp" contract="Interfaces.ITestingApp" />
                    <host>
                          <baseAddresses>
                                <add baseAddress="net.tcp://desk01:9878/TestingAppService" />
                                <add baseAddress="http://desk01:9876/TestingAppService/" />
                          </baseAddresses>
                    </host>
              </service>
        </services>
    <diagnostics>
      <messageLogging logEntireMessage="true"
                      logMalformedMessages="true"
                      logMessagesAtTransportLevel="true" />
    </diagnostics>
  </system.serviceModel>

Tks so much for any help. ANY advice would be greatly appreciated.


After I transfered the WCF service from a self-hosting executable to IIS/AppFabric, with the same exact code and database modeling, I was able to use all 4 cores without a problem. I got great performance after transferring.
Tks


From the comments it looks like your bottleneck is the database.

If this is the case, the best optimisation you could do would be avoiding disk access by caching data in memory.

Since you already use Enterprise Libray you could use that. We have used that on several projects, it worked well for us.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜