Chapter 4. Instance Management

Instance management is the name for a set of techniques used by WCF to bind client requests to service instances, governing which service instance handles which client request. You need instance management because applications differ too much in their needs for scalability, performance, throughput, transactions, and queued calls. When it comes to those needs, there simply isn’t a one-size-fits-all solution. However, there are a few canonical instance management techniques that are applicable across the range of applications, thus enabling a wide variety of scenarios and programming models. These techniques are the subject of this chapter, and understanding them is essential to developing scalable and consistent service-oriented applications. WCF supports three types of instance activation: per-call services allocate (and destroy) a new service instance per client request. Sessionful services allocate a service instance per client connection. Finally, with a singleton service, all clients share the same service instance across all connections and activations. This chapter provides the rationale for each of the instance management modes; offers guidelines on when and how to best use them; and also addresses some related topics such as behaviors, contexts, demarcating operations, instance deactivation, and throttling.[*]



[*] This chapter contains excerpts from my article “WCF Essentials: Discover Mighty Instance Management Techniques for Developing WCF Apps,” MSDN Magazine, June 2006.

Get Programming WCF Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.