Freigeben über


What’s New in WCF 4: Performance

This list is a bit different in places from what you’ve seen in the beta 1 release and there’s always a chance that things might change again.

The second part of the list covers some of the new features and changes to existing features to improve service performance. These performance features are tailored to specific scenarios. Enabling these features when unnecessary might even slow your application down. You should measure whether your application actually gets some benefit before taking advantage of these.

- Increased default values for service throttles: almost everyone has to change the throttle settings today so we’ve made the default throttle settings a better match for the capacity of modern machines. The MaxConcurrentCalls and MaxConcurrentSessions are now scaled by the number of processors and the base value of MaxConcurrentSessions has additionally increased from 10 to 100. You’re still able to set your own values for service throttles through a ServiceThrottlingBehavior if you don’t like the defaults.

Asynchronous service replies: in most cases it’s faster for the service to reply synchronously than asynchronously (by contrast, the opposite is true for the service to receive requests). However, if you have a service that frequently completes most of its outstanding calls at the same time, then you might see better performance by sending the replies asynchronously. We’ve added an asynchronous send behavior that can be applied to an endpoint to enable this option. This might change the order in which replies are sent so you have to be sure that the application is able to tolerate this before enabling the feature.  
  • Multiple asynchronous receives: although a service might receive messages from many channels and may be processing many messages at once, the handoff between a channel and the service is typically done one at a time. This is in most cases faster than trying to handoff multiple messages at once as the handoff is made simpler and each one is supposed to be extremely inexpensive. However, it is possible to install service extensions that block until completion during this handoff. We’ve introduced an endpoint behavior that allows you to increase the number of messages that a service will try to retrieve from a channel at once. This changes the timing for handing off messages so you have to be sure that the application is able to tolerate this before enabling the feature.