Question

I'm looking at the viability of using AppFabric as a data cache for our our data. Our data is:

  • accessed 4 million times a day
  • updated 50k times a day.
  • searched 500k times a day.

It houses around 100 million members, where one update will affect 2-10 members which would all then need to be updated in the cache; cache would be updated 100k-500k times a day.

My servers have 128gb of RAM.

I have concerns regarding garbage collection and latency with the cache.

Effectively I do not want garbage collection to clear any of the cached data - it needs to live until I refresh it. (We know when the update is required to the cache) Is this possible with AppFabric? Some of this data I want to sit around for days - 1 year at a time.

  • How much does latency increase when you're running a DataCache of multiple GB?
  • Can AppFabric work in a Master/Master model? You are running 5 servers that house the cache, if one gets updated, that update is then propagated to the other servers?
Was it helpful?

Solution

AppFabric cache was not designed for "Scaling Up" but for "Scaling Out".

Memory is now very cheap and network cards are very fast. AppFabric Cache works well on lower cost machines usually employed for web servers as opposed to database servers which require expensive hardware. AppFabric is IO-bound and not CPU-bound unless you have a huge number of large data items.

Cache size has low impact, except for large caches with high percentage of writes. Among other factors, high write workloads put greater pressure on .NET garbage collection when the size of the managed heap is large.

So, it's better to span multiple medium servers. You will have better latency and you can enable high availability.

Reading your question, I think you are confused about objects's lifetime. AppFabric will remove your object only in two circonstances :

Expiration

When adding an item to the cache, an optional object time-out value can be set for the particular cached object that will determine how long it will reside in cache. It can be turned off for a named cache.

Eviction

As an in-memory cache, AppFabric does not persist the cache to disk. This means that, memory is limited and the cache size cannot grow beyond a certain limit, which could be the total memory available for the server or a configured maximum cache size. When the memory consumption of the cache service on a cache server exceeds the low watermark threshold (70%), AppFabric starts evicting objects that have already expired

What is important here, it that you can't assume an object will stay in AppFabric forever.

Grid Dynamics has completed performance and scalability analysis of Windows Server AppFabric Cache. The data for analysis was collected from a large number of tests conducted with varying usage patterns, workloads, and configuration of the cache. This white paper presents the results of the study and covers some common use cases, which can be used in capacity planning for your application. Download it here and source code here.

Since version 1.1, Appfabric now supports Read-Through and Write-Behind. This may also help you.

OTHER TIPS

If you configure the server correctly, garbage collection will not be a problem. You can configure how long it takes an item to expire, whether objects in a cache can expire, whether eviction is on or not, etc. You can even put a lock on items in the cache so that they are not expired while you are using them. This page here explains expiration and eviction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top