Many ASP.NET applications today are deployed in multi-region (multi-data center) deployments, either in the Cloud or on-premises. With these applications, you often need to redirect users from one region (data center) to another. However, you cannot afford to lose any ASP.NET Session State in the process.
Such multi-region deployments usually prefer to keep user sessions in the same region where they were created. Essentially, they do not engage in cross-region load balancing at the user request level. But, quite frequently, you need to bump users to other regions for the following reasons:
You will have to do this a way where ASP.NET Session State is not lost. One way to solve this problem is by replicating all your ASP.NET sessions to multiple regions. NCache provides a WAN Replication feature for this.
However, in many scenarios, replicating all ASP.NET sessions across regions may not be necessary—especially if you're only shifting 10–20% of the users. In such cases, you may simply want the ASP.NET Session State to move or follow the user when they are redirected from one region to another.
The NCache provider has the intelligence to handle all such cases. It lets you specify all the regions in your web.config file, and then when a user is redirected to another region, their ASP.NET session is moved from the source region distributed cache to the destination region distributed cache.
NCache is an extremely fast and scalable Open Source distributed cache for .NET. It handles extreme transaction load by allowing you to add more cache servers at runtime and scale linearly. NCache also provides intelligent cache replication so you don't lose any ASP.NET Session State if a web server or a cache server goes down.
NCache lets you define one primary and multiple secondary ASP.NET Session State caches in your ASP.NET web.config as follows. Please note that for each region, the "primaryCache" is different.
<ncache>
<sessionLocation>
<primaryCache id="LondonCache" sid-prefix ="LDC"/>
<secondaryCache id="NewYorkCache" sid-prefix="NYC"/>
<secondaryCache id="TokyoCache" sid-prefix="TKC"/>
</sessionLocation>
</ncache>
All ASP.NET sessions are originally stored in their "primaryCache". Then, when the user is bumped to another region, the Multi-Region ASP.NET Session State Provider for NCache in that region notices that this ASP.NET Session is from another region. And, it connects to the corresponding "secondaryCache" and moves the ASP.NET Session to its "primaryCache" so it is available from here.
First of all, there is no programming required to use NCache as your Multi-Region ASP.NET Session State Provider. You simply modify your web.config and specify NCache as your Session State Provider (SSP). Refer to the page on configuring Multi-Region ASP.NET Session State Provider. Following are some of the benefits of using NCache as your Multi-Region ASP.NET Session State Provider:
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.