Sitemap

      Develop high speed .NET applications

Home

 
Products  |  Services  |  Partners  |  Press Room  |  Support  |  Buy  |  Download  |  About Us
 
Alachisoft.com
  a
 Fast and Scalable Distributed ASP.NET Sessions for Server Farms

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

Data Caching & Clustered Object Caching

Distributed 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 distributed sessions.

    
bullet  Many times faster and more scalable than storing sessions in SQL Server
a
     bullet  Highly available due to replication and dynamic clustering
a
     bullet  Support for multiple geographical sites sharing sessions


.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, Partitioned, and Client cache topologies
a
       Relationship management with key, file, and database dependencies
a
       High-Performance object query for distributed cache
a

 
   
 

[ Download Trial ]  [ Sessions Details ]  [ Session Video ]

[ NHibernate Details ]  [ CAB Details ]  [ NCache Express CTP ]

 
 

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 Distributed ASP.NET Sessions in Server Farms

NCache lets you transform your regular ASP.NET sessions into distributed sessions without any code change. You follow a few simple steps and your existing ASP.NET applications can suddenly benefit from powerful distributed sessions. Below are some of the benefits of using distributed 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 distributed 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.

  8. Share sessions across multiple geographical sites: NCache lets you share sessions across multiple geographical sites. You can now host your application in multiple sites and have users go from one location to another without losing their sessions.

How Does It Work?

Using NCache Distributed Sessions is very simple. You have two 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 (no code change)

NCache provides an HttpModule for ASP.NET 1.1. 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. Read Using NCache for ASP.NET Sessions for more details.

1. Install NCache on each web server. Make sure you configure cache server properly for multiple network cards. See online help for details.

2. Define a distributed cache: Use NCache Manager (a graphical tool) to define a distributed cache that is appropriate for you. For small web farms, use Replicated Cache. And, for larger web farms, use Partition-Replica caching topology. 2-node web farms should keep cache on web servers but larger web farms should use a separate caching tier of 2 or more cache servers. Make sure you test the distributed cache to ensure it is properly working. See details in online help.

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.2.1.0, Culture=neutral,
                 PublicKeyToken=cff5926ed6a53769
"/>
            </httpModules>

Please note "Version=3.2.1.0" should match the NCache version you have downloaded. Once you do this, you’re ASP.NET application is ready to start using distributed 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. You can also read Using NCache for ASP.NET Sessions for more details.

1. Install NCache on each web server. Make sure you configure cache server properly for multiple network cards. See online help for details.

2. Define a distributed cache: Use NCache Manager (a graphical tool) to define a distributed cache that is appropriate for you. For small web farms, use Replicated Cache. And, for larger web farms, use Partition-Replica caching topology. 2-node web farms should keep cache on web servers but larger web farms should use a separate caching tier of 2 or more cache servers. Make sure you test the distributed cache to ensure it is properly working. See details in online help.

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.

<assemblies>
     <
add assembly="Alachisoft.NCache.SessionStoreProvider,
                   Version=3.2.1.0, Culture=neutral,
                   PublicKeyToken=CFF5926ED6A53769
"
/>
</
assemblies>

      <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>

Please note that Version=3.2.1.0 should match the specific NCache version you've downloaded. Once you do this, you’re ASP.NET application is ready to start using distributed sessions.

Multiple Geographical Sites Sharing Sessions

If you have an ASP.NET application that hosted in multiple geographical locations and you want your users to be bounced from one location to another without losing sessions, you can do that with NCache. In order to do that you need to follow these simple steps. You can also read Using NCache for ASP.NET Sessions for more details.

1. Define a separate distributed cache for each location: You must define a separate replicated or partition-replica cache for each location.

2. Modify web.config file for each location: In addition to other web.config changes mentioned above, you must also specify the following in each location.

  <configSections>
      <
section name="ncache"
         
type="Alachisoft.NCache.Web.SessionStateManagement.NCacheSection,
                Alachisoft.NCache.SessionStateManagement, Version=3.2.1.0,
                Culture=neutral, PublicKeyToken=CFF5926ED6A53769
"/>
  </
configSections>

  <ncache>
      <
sessionLocation>
            <
primaryCache id="londonReplicatedCache" sid-prefix="lndr"/>
            <
secondaryCache id="newyorkReplicatedCache" sid-prefix="nykr"/>
            <
secondaryCache id="tokyoReplicatedCache" sid-prefix="tkyr"/>
      </
sessionLocation>
  </
ncache>

Please make sure that Version=3.2.1.0 matches the specific version of NCache you have downloaded. For more details on this, please see online help.

   
 
     
 


 
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