Sitemap

      Develop high speed .NET applications

Home

 
Products  |  Services  |  Partners  |  Press Room  |  Support  |  Buy  |  Download  |  About Us
 
Alachisoft.com
a
  NCache
a

    Intelligent Caching

    Clustering Topologies

    Session Topologies

    What's New in 3.2?

    Features

    Online Demos

    Online Support

    Forum

    FAQ

a
       
  Download 60-day Trial of NCache  
   
       
  a
 Fast and Scalable Clustered ASP.NET Sessions for Server Farms

a
NCache provides extremely fast and highly scalable ASP.NET Clustered Session State for .NET applications running in server farms. NCache is a clustered object cache for .NET and clustered sessions use this same object caching engine. Transform you existing ASP.NET sessions into clustered sessions without any code change.

Data Caching & Clustered Object Caching

Clustered ASP.NET Sessions for Server Farms
 
Eliminate the bottlenecks of sticky sessions in load balancer or storing sessions in SQL Server. Scale up your application with extremely fast in-memory clustered sessions.

    
bullet  Many times faster than storing your sessions in SQL Server
a
     bullet  Highly available due to dynamic clustering and no single-point-of-failure
a
     bullet  Highly scalable due to replicated and partitioning clustering topologies


.NET Distributed Caching for Server Farms
 
Reduce expensive database trips by caching data close to your application. Distributed caching enables you to do this in a server farm environment. NCache provides

    
  Dynamic clustering with Replicated and Partitioned cache topologies
a
       Relationship management with key, file, and database dependencies
a
       High-Performance object query for distributed cache
a

   
Caching Details
 

 
   

[ Download Trial ]         [ Sessions Video ]         [ Session Topologies ]

 
 

Drawbacks of Regular ASP.NET Session State in Server Farms

Although adding web servers to the farm is a great way to scale up ASP.NET applications, one thing that does not scale well is ASP.NET Session State itself. Following are some of its drawbacks:

  1. Loss of session data if using InProc, StateServer, or SqlServer mode without clustering.

  2. Slow performance if you store session data in SQL Server.

  3. Not scalable if using InProc or StateServer modes and expensive scalability thru SQL Server.

  4. Single point of failure if you're using InProc, StateServer, or SqlServer without clustering.

  5. Expensive high availability if using SqlServer mode due to cost of SQL Server clustering.

  6. Maintenance downtime difficult if using InProc or StateServer mode.

Benefits of NCache Clustered ASP.NET Sessions in Server Farms

NCache lets you transform your regular ASP.NET sessions into clustered sessions without any code change. You follow a few simple steps and your existing ASP.NET applications can suddenly benefit from powerful clustered sessions. Below are some of the benefits of using clustered sessions:

  1. No loss of session data: You can replicate your session data to multiple nodes and avoid any loss of data if a web server crashes.

  2. High performance: Keep your session data close-by (either InProc or local OutProc) on all web servers for an extremely fast performance. Even keeping a separate clustered caching-tier for session data is much faster than accessing SQL Server.

  3. Highly scalable: You have a rich set of clustering topologies (replicated, partitioned, and client nodes) that allow you to scale up to 100’s of web servers in your farm without compromising on performance.

  4. No single point of failure: Clustering the session allows you to eliminate all single points of failures from your environment. This makes your application highly available.

  5. Low cost high availability: Instead of buying expensive SQL Server clustering, you can cluster sessions on your web servers without the need for any additional expensive hardware.

  6. Easy maintenance downtime: Clustering means that data is not only on one server. This allows you to schedule down time for your servers without any problem.

  7. 100% Native .NET: NCache is a 100% native .NET product. This means that you can expect us to stay on top of all additions and changes to .NET as compared to a non-.NET solution.

How Does It Work?

Using NCache Clustered Sessions is very simple. You have three options for incorporating session clustering into your application. Two require no code change and the third requires minor code change. Here they are:

1. Use HttpModule for ASP.NET 1.1 & 2.0 (no code change)

NCache provides an HttpModule for ASP.NET 1.1 and 2.0 (although for 2.0 there is a more suitable option). This HttpModule intercepts all Http Requests and Responses and synchronizes the regular SessionState with NCache. This allows you to incorporate session clustering without any code change to your ASP.NET application.
 


Incorporating NCache HttpModule into your ASP.NET is a simple three-step process as described below.

1. Install NCache on each web server

2. Define a clustered cache: Use NCache Manager (a graphical tool) to define a clustered cache that is appropriate for you. You should either select replicated cache or partitioned cache with backup nodes. And, you can also specify whether the cache should reside on each web server or whether you should have a separate caching tier (again a cluster of multiple servers) where all the session cache is kept. For larger configurations, a separate caching tier is sometime more appropriate.

3. Modify web.config file to add the HttpModule information and the name of the cache you’ve just created. NCache provides a sample project called guessgamehttpmodule that demonstrates how to use HttpModule option for sessions. Here is a sample web.config:

       <appSettings>
              <
add key="CacheName" value="myReplicatedCache"/>
      
</appSettings>
            <
httpModules>
            <
add name="NCacheWebSessionState"
                 type
="Alachisoft.NCache.Web.SessionState.NSessionStateModule,
                 Alachisoft.NCache.SessionState, Version=3.0.0.0, Culture=neutral,
                 PublicKeyToken=cff5926ed6a53769
"/>
            </httpModules>

Once you do this, you’re ASP.NET application is ready to start using clustered sessions.

2. Use SessionState Provider in ASP.NET 2.0 (no code change)



 

For ASP.NET 2.0, NCache also provides a custom SessionState Provider that synchronizes your regular ASP.NET Session with NCache. This allows you to use session clustering without any code change. Just like the HttpModule option, this is also a simple three-step process as described below.

1. Install NCache on each web server

2. Define a clustered cache: Use NCache Manager (a graphical tool) to define a clustered cache that is appropriate for you. You should either select replicated cache or partitioned cache with backup nodes. And, you can also specify whether the cache should reside on each web server or whether you should have a separate caching tier (again a cluster of multiple servers) where all the session cache is kept. For larger configurations, a separate caching tier is sometime more appropriate.

3. Modify web.config file: to add the SessionState Provider information and the name of the cache you’ve just created. NCache provides a sample project called guessgamesessionstoreprovider that demonstrates how to use SessionState Provider option for sessions.

      <sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom"
                   
customProvider="NCacheSessionProvider" timeout="1">
           
<providers>
                  <
add  name="NCacheSessionProvider"
                        type
="Alachisoft.NCache.Web.SessionState.NSessionStoreProvider"
                       
cacheName="myreplicatedcache" writeExceptionsToEventLog="false"
                       
AsyncSession="false"/>
           
</providers>
      </
sessionState>

Once you do this, you’re ASP.NET application is ready to start using clustered sessions.

3. Use NCache Session Object (minor code change)

In most cases, using either HttpModule or SessionState Provider is the better choice because it has a more optimal performance. However, if your session is very large, contains numerous items, and your ASP.NET page changes only a few of them, then it might be more efficient for you to use NCache Session Object. This session object then updates the cache with only those items in the cache that you have modified instead of copying the entire session into the cache.

To use this object, you need to follow these steps:

  1. Install NCache on each web server
  2. Define a clustered cache: Use NCache Manager (a graphical tool) to define a clustered cache that is appropriate for you. You have the option of replicated cache, partitioned cache, and partitioned cache with backup nodes. And, you can also specify whether the cache should reside on each web server or whether you should have a separate caching tier (again a cluster of multiple servers) where all the session data is kept. For larger configurations, a separate caching tier is sometime more appropriate.

  3. Modify each ASP.NET file: The changes are very minor but must be made to each ASP.NET file so it starts using NCache Session Object instead of the regular ASP.NET Session object. The changes are:

    1. Include Alachisoft namespace as following:
      i
      .      using Alachisoft.NCache.Web.UI;
    1. Change the base class to NPage
      i
      .      public partial class MainForm : NPage
  1. Modify Global.asax.cs (or Global.asax.vb) file as following:
    1. Include Alachisoft namespace as following:
      i.      using Alachisoft.NCache.Web;
      ii.
            using Alachisoft.NCache.Web.Caching;
    1. Change base class to NHttpApplication:

      i.      public class Global : NHttpApplication

    1. Initialize NCache in Init() method
      i.      string cacheName = ConfigurationSettings.AppSettings["CacheName"];                          
      ii.      NCache.InitializeCache(cacheName);

   
 
     
 


 
Why Session Clustering?
a

No loss of session data
Faster performance
More scalable
No single point of failure

a

 
 
 
 
  a  
   
 
 

 Copyrights 2007: Alachisoft, all rights reserved