Last post Jul 18, 2011 06:11 AM by S1lv3r007
Nov 12, 2007 12:26 PM|Caturday MMXXV|LINK
I am trying to determine which method of State management to use and I need some advice from anyone who has faced this situation before. I have a single server that runs ASP.NET/IIS and SQL Server 2005. It is Server 2003 32 bit, so I am limited to 4GB
of RAM. I have Dual Dual Core Processors. With a system such as this, what are my advantages/disadvantages to using either method of state management.
Out of Process will use up too much Ram if too many people hit the server at once.
SQL Server will slow page load times because most of the site will be dynamically built based off of db values. Web pages created with lots of DB queries to allow for maximum flexibility with no hard coded values.
Which of these concerns should I be more worried about in a real world scenario, where am I more likely to hit a wall?
Nov 12, 2007 12:35 PM|vcsjones|LINK
Nov 12, 2007 12:47 PM|Caturday MMXXV|LINK
thanks for the advice. So I would probably be better served just using Session/Key Value pairs?
Nov 12, 2007 12:48 PM|vcsjones|LINK
Just use Session["blah"] = someserializableobject;
Don't change the sessionMode in the web.config. Leave it to InProc.
Jul 01, 2011 05:54 PM|John Culviner|LINK
There is really no point in doing it out of process if it is in the same server. You might as well leave it InProc. The purpose of Out Of Process is to offload the memory load to another server. SQL will just as well effect your memory usage as well. My recommendation
is to leave it InProc if you are only going to utilize one server. SQL is better used when you want to ensure that a user's session is never lost by replicating on a SQL farm, so even if one SQL server goes down, the failover partner will pick it up.
I would like to mention that if you are running in "Web garden" mode you have multiple w3wp processes running per Application Pool on the same server. This means that "InProc" isn't an option because the first request might hit process A and the second request
proccess B etc. and session state wouldn't work. In this case you MUST use SqlServer or StateServer mode.
Jul 18, 2011 06:11 AM|S1lv3r007|LINK
If you are using version 4 of the NET Framework then you can still benefit of using StateServer or SQL Server to manage your sessions
even if it still on the same server. NET 4 has the ability to compress session data, lessening the memory load on the web-server at the expense of CPU load (monitor carefully).
Also, if your web-server has more than one CPU core, it is worthwhile setting the Application Pool in IIS to have > 0 webfarm. This will create the same number of w3wp.exe processes which will enable your application and session values to retain if any of
the w3wp.exe's fail.
InProc will always be the fastest but StateServer and SQLServer will provide you more robustness for your web applications.