Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowing Session in a Web Farm? Is StateServer Good Enough?

Tags:

First of all to give you a bit of background on the current environment. We have a number of ASP.NET applications, all of which use session for certain aspects. We are "Load Balanced" over multiple servers due to traffic levels, however, our load balancing is set to use "Sticky Sessions" as currently all web applications are set to use "InProc" for session state.

We are looking at being able to remove the "Sticky Sessions" configuration on our load balancer, as due to our traffic loads servers can and do get overloaded. We want to go with a more balanced approach, but must be able to use session.

I know that SqlServer for session state will work, but for reasons beyond our control, we cannot use SqlServer to store our state. In researching it seems that StateServer is our best bet. We have an additional server, with loads of memory sitting around. This server could be our StateServer for the entire Web Cluster. We just want to know the following things.

1.) Besides any potential serialization issues with the switch from InProc to StateServer, are there any major known issues with losing session objects or generating errors with the above listed environment?

2.) Aside from the single point of failure, and slighly slower performance are there any other gotchas that we need to be aware of with using StateServer.

3.) Are there any metrics that show the performance differences between the three types of state storage?

like image 440
Mitchel Sellers Avatar asked Mar 26 '09 17:03

Mitchel Sellers


People also ask

Why session States work on some Web servers but not on others?

One of the server will use cookies to track the session and the other one Cookieless ( hence URI ) to track the same session and thus, if the request gets forwarded to different servers, NO session will be detected.

What is InProc session?

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.

What is StateServer?

ScaleOut StateServer(R) is an in-memory data grid (distributed cache), which runs as a distributed software service on a set of dedicated virtual servers. It stores data objects in memory, makes them instantly accessible to networked Web or application servers, and scales to handle large workloads.


1 Answers

Here is a decent FAQ on asp.net state: http://www.eggheadcafe.com/articles/20021016.asp

From that Article, here is some information on StateServer:

  • In a web farm, make sure you have the same MachineKey in all your web servers. See KB 313091 on how to do it.
  • Also, make sure your objects are serializable. See KB 312112 for details.
  • For session state to be maintained across different web servers in the web farm, the Application Path of the website (For example \LM\W3SVC\2) in the IIS Metabase should be identical in all the web servers in the web farm. See KB 325056 for details
like image 109
AaronS Avatar answered Sep 20 '22 15:09

AaronS