4

I'm just starting out using AppFabric...

My application is in healthcare - we have about 15000 users of the system and they access patient information in bursts (e.g. think of a team of nurses/doctors accessing a patient when they are hospitalized).

What I'd like to do is cache certain items (e.g. patient demographics info) in memory and other items (e.g. labs, medications, diagnostic imaging, reports) on the cache host server. The underlying data comes from various 3rd party systems, some of them extremely slow to return data.

Does anyone know if it is possible to indicate that certain items go into the local cache while others go to the server? There is too much data to all fit into memory. In looking at the MSDN documentation, here is a sample config file.

   <dataCacheClient requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1">
      <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
      <clientNotification pollInterval="300" maxQueueLength="10000"/>
      <hosts>
         <host name="CacheServer1" cachePort="22233"/>
         <host name="CacheServer2" cachePort="22233"/>
      </hosts>
      <securityProperties mode="Transport" protectionLevel="EncryptAndSign" />
      <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" 
                           maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" 
                           receiveTimeout="600000"/>
   </dataCacheClient>

It looks like enabling local cache enables for the entire cache client?

To support the scenario I describe, does this mean I'll have to create two cache clients and my code will have to know / be aware of which cache client to put data into? Or is there an API/flag/parameter I can use at time of storing data into the cache? Or perhaps, handled by using Regions/Tags?

Thanks!

Raymond
  • 3,382
  • 5
  • 43
  • 67

1 Answers1

2

Assuming you're using AppFabric 1.1, you can configure multiple dataCacheClient nodes with differing configurations. So using your existing example, you would do something like:

<!-- local caching client -->
<dataCacheClient name="LocalCaching" requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1">
  <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
  <clientNotification pollInterval="300" maxQueueLength="10000"/>
  <hosts>
     <host name="CacheServer1" cachePort="22233"/>
     <host name="CacheServer2" cachePort="22233"/>
  </hosts>
  <securityProperties mode="Transport" protectionLevel="EncryptAndSign" />
  <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" 
                       maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" 
                       receiveTimeout="600000"/>

Then from code you have different DataCacheFactoryConfigurations using the constructor that takes a name instead of just using the default:

DataCacheFactoryConfiguration localCachingFactoryConfig = new DataCacheFactoryConfiguration("LocalCaching");

DataCacheFactoryConfiguration remoteOnlyCachingFactoryConfig = new DataCacheFactoryConfiguration("RemoteOnlyCaching");

Then you just create your DataCache instances from the appropriate factory in code based on which type of caching you require for the data you're working with.

Drew Marsh
  • 33,111
  • 3
  • 82
  • 100
  • Thanks, that's what I was looking for. Silly me, my company was on v1.0 and didn't realize it. – Raymond Oct 19 '12 at 20:54
  • So if I am stuck on v1.0, is there anyway to get this multiple client to work? – Raymond Oct 19 '12 at 21:03
  • There is no config based approach to solving this problem in 1.0 unfortunately. However, it's totally doable in pure code by configuring the DataCacheFactoryConfiguration instances yourself programatically. You just have to make up your own config entries to store the different properties. – Drew Marsh Oct 20 '12 at 04:37
  • I just upgraded to AppFabric 1.1 -- and following the instructions, I get a System.MethodAccessException. Any ideas? – Raymond Oct 26 '12 at 00:27
  • Sounds like you have some binaries that are out of sync somewhere. I assume this is in your client? How are you referencing the client libraries? They are no longer in the GAC for 1.1 IIRC, I suggest using the ServerAppFabric.Client NuGet package. – Drew Marsh Oct 26 '12 at 01:49