Sunday, April 19, 2020

In-proc and Out-proc session

In-proc session state

An inproc server runs in the same process as the calling application. It's close to a normal function call on a dll. In-Process stores the session in memory on the web server. This requires the "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server.
InProc session mode indicates that session state is stored locally , means that with InProc session state mode is store objects in the AppDomain of the Web application. Because of this the session state is lost when IIS (Internet Information System) restarts. For small, very stable sites, InProc is perfectly acceptable and possibly even ideal. InProc also has the benefit of being able to hold any memory object in session. This can also be problematic if you attempt to hold enormous objects.

Outproc session state

StateServer mode/OutProc, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. Calling an outproc server , data needs to be marshalled across the process boundry which is an expensive operation.
The basic necessity of using the Outproc session is when you have deployed your application in web farm or web garden. Outproc session should be used when you expect issues like if you are modifying you web.config file or bin folder at runtime or IIS restart on server. As State server mode gives a advantage that it will not lose the data even if your application crash.

No comments:

Post a Comment