Thursday, April 23, 2009

Why not use IP affinity and in-process session for V2 portal?

Problem:
A friend proposed using sql server session instead of in-process session for V2 portal. My reason of using in-process session is that I thought IP affinity can resolve web farm issue and in-process session is simpler and faster than SQL server session. After further investigation, I found IP affinity cannot address web farm issue for V2 portal.

The types of IP affinity are described in <>:

“Single— In this mode, requests from new IP addresses are load balanced normally. From then on, the same server handles all requests from a given IP address. If servers are maintaining state information locally, this is a good setting for an intranet. However, Internet clients might seem to be coming from multiple IP addresses because of their service providers' network address translations, so this affinity mode won't work with the Internet.

Class C— In this mode, each range of 253 IP addresses in a Class C range is handled by a single cluster member. This mode largely defeats load balancing (because once a range of IP addresses is associated with a node, it won't ever be load balanced to another node), but it ensures that Internet users will always connect to the server that's maintaining their state information locally.


As you can see, Single mode works intranet but not internet. Therefore, Single mode may work for V1 portal (which uses windows authentication and is deployed in extranet) but not for V2 portal (which uses WLID and is deployed in data center). Class C mode is not really a real load balancing.

Conclusion:
Thus, V2 portal has no other choice than using SQL server session.

Risk/Disadvantage of using SQL server session:
It is safe to assume that out-of-process session is 15-30% slower, depending upon variables such as network speed and the size of the object or objects being serialized. (http://www.eggheadcafe.com/articles/20020302.asp)

What to do to switch to SQL server session:
1. Make the classes used in SessionObject serializable.
2. update the V2 portal installer to support Server sql session.

This is the command to create session related tables in PortalDB instead of the default TempDB.

C:\Windows\Microsoft.NET\Framework\v2.0.50727>
aspnet_regsql.exe -S MachineName\SqlInstanceName –E -d PortalDB -ssadd -sstype c

No comments: