Caching in a load balanced environment

Topics: General Topic, NetSqlAzMan Core
Nov 2, 2011 at 5:05 PM

Our application is deployed to a load balanced cluster where two or more IIS instances serve content to calling clients - I'm trying to determine the best way to cope with netsqlazman caching in this environment.

I don't think the WCF service cache is an option for us because we're trying to avoid introducing a single point of failure in our load balanced environment however our current implementation where we use the in proc StorageCache and the RoleProvider (which uses the StorageCache internally) is proving problematic due to stale cache issues in our load balanced environment.

I suppose I could make a change to our application to force a StorageCache rebuild when something is not found in the cache but this approach seems like it might negate the benefits of having a cache in the first place. Another option might be to do some sort of IIS -> IIS cache invalidation but I'm not sure whether this is a good approach either so I just thought I'd put the question out for comment really - do you have any ideas for solving our caching problem in this scenario? Thanks!

Coordinator
Nov 3, 2011 at 9:50 AM

Hi,

NetSqlAzMan WCF Cache Service is already compliant with a Cluster environment.

My suggestions:

1) Install the WCF Cache Service on each web server

2) In the NetSqlAzManCacheService.exe.config file of the Web Server 1 change the WCFCacheServicePartners appSetting … to ensure to point to the Web Server 2 NetSqlAzMan WCF Cache Service

3) In the NetSqlAzManCacheService.exe.config file of the Web Server 2 change the WCFCacheServicePartners appSetting … to ensure to point to the Web Server 1 NetSqlAzMan WCF Cache Service

In this way when the cache was cleared on the server 1 … server 1 will invalidate automatically the cache on the server 2 … and viceversa.

<appSettings>

<add key="expirationValue" value="0 1 0 0"/>

<!-- days hours minutes seconds -->

<add key="StoreNameFilter" value=""/>

<!-- Syntax "Store1;Store" or leave empty for all Stores -->

<add key="ApplicationNameFilter" value=""/>

<!-- Syntax "Application1;Application" or leave empty for all Applications -->

<add key="WCFCacheServicePartners" value="net.tcp://otherserver1:8000/NetSqlAzMan.Cache.Service/CacheService/"/>

<!-- WCF Cache Service Partners (Endpoint1;Endpoint2;...); Invalidate Cache will be invoked on all other partners -->

<!-- net.tcp://otherserver1:8000/NetSqlAzMan.Cache.Service/CacheService/;net.tcp://otherserver2:8000/NetSqlAzMan.Cache.Service/CacheService/-->

<!-- leave empty if no ServicePartners -->

<add key="AsyncCacheBuilding" value="true"/>

</appSettings>

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com