1
votes

I am considering using AppFabric caching for my application but am unclear of how to get it to do what I want. I have 1 SQL cluster in 1 location. I have 200+ application servers around the globe. I want to put an AppFabric caching cluster in each of those locations so that the application servers have quick access to the SQL objects. In addition to quick access, I need them to have access to the data in the event that the SQL cluster is inaccessible.

There is an HR app which directly updates the SQL cluster so that data is changing. The application servers will also update the AppFabric cache in many locations. All this data needs to stay in sync. Here are my questions:

  1. How will the cache be updated when the DB has changed? I read that SQLDependency is what I need but I also read that once there is a change, my entire cache will be flushed out and will have to resync. I want just changed objects to be sent to the multiple caches for updating.

  2. What happens if the SQL cluster is inaccessible and the cache cannot find objects being requested?

  3. Is there a better way to do what I am trying to do? This is more about SQL object availability than it is about performance. About to research MS Sync Framework...

2

2 Answers

1
votes

AppFabric has no support for cache dependency objects like SqlCacheDependency, but what you can do instead is create a read-through/write-behind cache provider for AppFabric. This provider knows the structure of your SQL Server database, so it can retrieve information from the database and can update your database when you make updates. Your application servers update the AppFabric cache, so your cache always has the latest version of your data, and the cache then writes the updates to the database asynchronously.

To cope with your HR app updating the back-end database, you can configure items in the cache to expire based on a time-to-live value, and a subsequent request to the cache will refresh the cached version.

0
votes

I know you posted this some time back but there are caching solutions that let you make use of cache dependencies to synschonize with the main datasources. The case in point in your situation which is SQL dependency is available with NCache. With NCache you can have multiple options to synchornize with the DB and once such option is "read-through". So essentially when the DB changes, the dependent Object is automatically removed from the cache and if read-through is enabled then the cache server automatically retrives the fresh copy of the object. You can read more about Database Synchronization here