Introduction
Session is well understood term for all of us and as per our common understanding it is (well, less or more) some duration in which entities recognize each other. Some of us might have played with it in ASP.NET as well. Concept is almost similar in WCF though technique and usage are a bit different.
In WCF there is always a service class instance that handles incoming service requests. These instances may already be there (at server when request arrives) or may be created as needed. In WCF the concept of session is mainly to manage these service instances so that server can be utilized in optimized way. At server there is one special class named InstanceContext that creates/loads service class instance and dispatches requests to it. The correlation can be perceived as –
You can see here how stuff is engaged. When some request arrives it is routed to service instance via instance context. Suppose there is a hit of thousand requests then service will have to create thousand instance contexts (which in turn will create thousand service instances) to handle these requests. If requests are served in this way then service is called PERCALL service as each request is served by a new instance context and service instance object (call them as service objects onwards). Consider there is a client who made 100 requests. If service identifies this client and always serves it by a dedicated service object then this type of service will be known as PERSESSION service as it recognizes the client and serves it by a single instance of service object. On the other hand if all the requests irrespective of client are served by a single instance of service objects then the service will be known as SINGLETON service. Following pictures summarize the concept–
Read more: Codeproject
0 comments:
Post a Comment