Session Loss In Webgarden

Session Loss In Webgarden


Web Garden:

 In webGarden scenario application pool can have multiple worker process assigned to it.
In this case there are possiblilities like users first requests get served by workerprocess A and second request
get served by worker process B. assuming you are using In-proc session, in above scenario your worker process A
has user session and worker process B was not aware of it so when user tries to request the page and page was serverd by worker process B.
Then ultimately user will be asked to reinitiate the session.
 To overcome this situateion you need to mark the objects of classes who participate into session storing mechanisum as serializable
and you need to define the storage space for Session values like Application state server or SQL server for maintaining session state.
Why do we need to mark the classes a serializable? 
Objects while crossing the boundries of application they need to mark as serializable otherwise it's not posible for them to cross the boundries.

Application Pool recycling and session values

 When application pool pro-actively or re-actively recycles the healty/ un-healthy worker process and incase you are using in-process memory for
storing the session values, you will loose the session values. To avoid loosing session values use out of process session storing mechanisum.
use either SQL server or State server.

Web Farm:
In web farm scenario multiple machine act like single one using Network load balancing cluster. In this case there are possibilities that
first request get serverd by Machine A and second request get server by machine B of NLB cluster. If session get stored in Machine A's in process,
how is it possible to have those session value at machine b's in process. To avoid this we need to store session values as shared resource like
SQL server or State server.
I learned NLB using this article http://www.west-wind.com/presentations/loadbalancing/networkloadbalancingwindows2003.asp

To let SQL server participate into session storing mechanisum you need to execute aspnet_regSQL with appropriate switch.

-Satalaj


 

IRequiresSessionState and sessionHow are you using session variables in Asp.net with C#.netSessions In AspnetSession application viewstatesession objectsAsp.net Session TimeoutAsp.net SessionAsp.net Session AbandonOLE DB provider SQLNCLI for linked server returned message Cannot start more transactions on this sessionAsp.net Interview Questions for 2 years or 3 years experianceHow to implement Captcha in Asp.net

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.