Search code examples
wcfcachingappfabricdistributed-caching

Cache Regions in Velocity/AppFabric using WCF


I have a service based architecture where a web farm full of asp clients hit application server farm of WCF services. Obviously all the database access is done by the WCF services. Now I would like to cache my frequently used database retrieved objects using Velocity at the service tier level. I am considering to make each physical application server also part of the cache cluster.

According to Velocity documentation, if I use regions, objects are stored only at a single host. I actually wouldn't have any problem if each host kept it's own cache provided that I could somehow synchronize them.

So my questions are

  1. If I create one region on one host is it also created on another one?
  2. When I clear a cache region, is it cleared on one host only?
  3. If I subscribe to a region level notification on all the hosts, can I catch events of one host on another one?
  4. In this scenario should I use regions at all or stay away from them?

I hope my questions are clear. Actually I am more interested in a solution to my problem than answers to my questions


Solution

  • Yes you are right in reading the doc that the region will exists only in one host.

    " I actually wouldn't have any problem if each host kept it's own cache provided that I could somehow synchronize them."

    When you say synchronize, you mean when HA in enabled ? Velocity would actually take care of that if thats what you meant.

    For the questions: 1. No. 2. Yes 3. Notifications will be sent to the client. So i am not sure if there is anyway to send notifications to other host. 4. Regions gives Search capabilities and takes away HA from you. In your case, you could use the advantages of HA.