StateServer or SQLServer?
What is/are the advantages of StateServer session mode? a. Its keeps the data separate from IIS so; if any Issue comes with IIS it will not hamper Session data.
InProc mode, which stores session state in memory on the Web server. This is the default. StateServer mode, which stores session state in a separate process called the ASP.NET state service.
The InProc Session State Mode stores session data in a memory object in the application worker process (aspnet_wp.exe) in the application domain. It is usually the fastest, but more session data means more memory is used on the web server, and that can affect performance.
Secure Session-State Configuration The session-state feature is enabled by default. While the default configuration settings are set to the most secure values, you should disable session state if it is not required for your application.
Here's some thoughts about pro's/con's. I've also added Microsoft Velocity Distributed Caching solution.
I think the assumption would be that you are using a web farm of some sort.
One use of state service is in a Web Garden (multiple worker-processes on the same machine). In this case, you can use load-balancing to keep a user's connection going to a particular server, and have the n worker processes all sharing the same state service.
EDIT: In the web garden + state service or sql server scenario, you also have the benefit of being able to recycle the worker processes on that machine w/o the connected clients losing their session.
I'm not as familiar with using SQL Server as a session state store, but I would think you would gain robustness by using an SQL Server in a cluster. In this case, you could still have multiple worker processes and multiple servers, but you would not have to use a sticky session (server affinity).
And one more note, you can use state service on a second machine, and have all server in the farm hit that machine, but you would then have a single point of failure.
And finally, there are 3rd party (and some home-grown) distributed state-service-like applications. Some of these have performance benefits over the other options, plus Session_End event will actually fire. (In both State Service and SQL Server session backing, there the Session_End in Global.asax will not fire (there may be a way of hooking into SQL Server)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With