PerfGoals
  • Check the application design for potential synchronous and asynchronous operations
  • Check the application design for WCF binding configurations
  • Determine the optimal service throttling settings for the application
  • Measure the WCF services' ServiceContract (methods) throughput and response times (server and client end)
    • Calls Per Second 
    • Call Duration       
  • Check if the application topology is scaled out by deploying them into a load balanced server farm
  • Execute both end to end and component level performance tests

PerfTesting

  • WCF service hosted in IIS (using certificates)
    • In VSTS solution, Add Service Reference to WCF service.  After you enter web address where service is hosted, you see list if services that can be found at the selected web address. Each service might contain multiple service contracts and/or endpoints. The operations displays a list of operations (methods) that are available for each service contract.
    • App.config is added to the solution consisting of service bindings and endpoints
    • If the application uses client certificates, you would install the cert and update the thumprint in the app.config

     <system.serviceModel>
        <behaviors>
        <endpointBehaviors>
          <behavior name="ClientCredentialsBehavior">
            <clientCredentials>
              <serviceCertificate>
                <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
              </serviceCertificate>
              <clientCertificate findValue="7e cd 30 4a 60 af 6f e5 e9 03 8f 4e 51 7d 8b bd cd 48 c7 29"
                                 storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
            </clientCredentials>
          </behavior>
   </system.serviceModel>

  •  
    • Add "behaviorConfiguration="ClientCredentialsBehavior" tag in each endpoint in the app.config file.  Example:

 <client>
    <endpoint address="
https://sdi-perf-ws07v.microsoft.com/Subscription/SubscriptionService.svc"
        binding="wsHttpBinding" bindingConfiguration="SubscriptopnServiceEndPoint" behaviorConfiguration="ClientCredentialsBehavior"
   contract="SubscriptionService.ISubscriptionService" name="SubscriptionServiceEndPoint" />
 </client>

  •  
    • Declare, intialize service client. Populate required data and call service operation. Make sure to close the client in the destructor. Example code:

SubscriptionService.SubscriptionServiceClient subscriptionServiceClient
subscriptionServiceClient = new SubscriptionServiceClient();

TestContext.BeginTimer("PurchaseOffer");
purchaseOfferResponse = subscriptionServiceClient.PurchaseOffer(Guid.NewGuid(), sCountryInfo, attributes);
TestContext.EndTimer("PurchaseOffer");

if (null != subscriptionServiceClient)
{
         if (subscriptionServiceClient.State != System.ServiceModel.CommunicationState.Faulted)
                    subscriptionServiceClient.Close();
         else
                    subscriptionServiceClient.Abort();
}

  •  
    • When you add this unit test to loadtest, you would need set 'Run unit tests in application domain' to TRUE
  • WCF service hosted in windows services

WCF Performance Counters

PerfTools

Performance Issues

  • Channel timeouts
  • Channel faulting
  • Database deadlocks
  • Throughput and response times violating the performance goals (SLAs)
  • Thresholds crossed for server resource utilization
  • WCF service hosted in IIS: Service behavior when the application pool recycles after default time (29 hours)