Home » Microsoft Technologies

AppFabric Cache Size Expands upon Eviction Disable


I have AppFabric cluster with a single node. I have set cache size = 100MB for this host. I did 2 test as follows:

1) I created named cache (Catalog). I had client storing, size of 1MB object, in for loop from 1 to 100. I checked the Eviction happens @ 91st objects as I expected. Because, the High Wm = 90%, that make sense.

2) I removed the cache and recreated it again (Catalog) - this time with -Eviction None to get a negative reply from cache host @ 91st object assuming Eviction process will not run or even if it will run, it would not clear the already cached items as its disabled instead of LRU. But when I ran the client application, this time also it let me store more than 91 objects. The Put() is success and did not throw any AppFabric ErrorCode or exceptions. I verified the cache shows that it stored more than 91 objects by using  Get-CacheStatistics cmdlet.

So, my question here is Is AppFabric expands the size to an arbitrary size irrespective of the specified size for that host in config file. Please answer my question. I will appreciate help on this one.




3 Answers Found


Answer 1


I verified the above scenario stores more than allocated cache size (above Hw of the given cache limit) in cache host of my appfabric cache cluster by reading the values of object from 1 to 200. I am even able to store double the size of allocated cache. So, whats the use of the size parameter in the host element of cluster config, then? Have any one tested the above scenario in your dev/test app-fabric cluster. Please someone answer this.




Answer 2


This is a good question. The Size that you specify for the Caching Service on a cache host is used for Eviction rather than being a guarantee of the size. So when you disable eviction, there is always the chance that you will run out of memory. As you have observed, without eviction disabled, the size setting for your cache host has no effect.

In essence, the caching service is deciding to honor your request to not evict, even if it means that you can get yourself into trouble. These warnings and more explanation can be found in this topic:

Eviction Troubleshooting (Windows Server AppFabric Caching)

I hope this helps explain the design. Let me know if you have more questions or concerns about this.



Answer 3

Thanks Jason, I think I got the information I needed.



I would like to know which is the max cache size for a single node and which is the max size for a single object in the cache.

I also would like to know how AppFabric will transfer large binary data between nodes (does AppFabric "chunk" the sending? is there a way to configure the behavior?)


Thank you


I am running cluster machine in Virtual Box in domain, by default service is running under Network service , i am also receiving  same error

please find the error details from error log below. any help will be great.

Log Name:  System
Source:  Service Control Manager
Date:   21-07-2010 16:42:07
Event ID:  7034
Task Category: None
Level:   Error
Keywords:  Classic
User:   N/A
The AppFabric Caching Service service terminated unexpectedly. It has done this 5 time(s).
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <Provider Name="Service Control Manager" Guid="{555908D1-A6D7-4695-8E1E-26931D2012F4}" EventSourceName="Service Control Manager" />
 <EventID Qualifiers="49152">7034</EventID>
 <TimeCreated SystemTime="2010-07-21T14:42:07.000Z" />
 <Correlation />
 <Execution ProcessID="0" ThreadID="0" />
 <Security />
 <Data Name="param1">AppFabric Caching Service</Data>
 <Data Name="param2">5</Data>




We want to be notified when object eviction happens in our project.

I read Cache Notifications (Windows Server AppFabric Caching) (http://msdn.microsoft.com/en-us/library/ee808091.aspx) but don't see an notification associated with object eviction.

Any way we can get to know when object eviction happens?



After looking around a bit and putting together a sample using 'Velocity' I was investigating if I was going to be able to use this in Azure.  It appears that the AppFabric for Azure is missing the 'Velocity' caching part.  Am I just missing something here?  Is the confusion because of the term 'AppFabric' actually talking about two different codebases?  Two different pieces of code called the same thing is very confusing when they don't contain the same functionality.

If I am not confused and there really is no 'Velocity' based caching available in the Azure cloud, then what are the options for having scalable a caching solution running totally in the Azure cloud environment?

I have been trying, and failing, to populate an AppFabric Cache from within an AppFabric Workflow (hosted within ASP.NET Development Server during debugging). I trigger the workflow and then attempt to instantiate a collection the wraps a DataCache. At the point where I try to instantiate a the DataCacheFactory (in order to subsequently create a DataCache) using the following code:

public CacheKeyedCollection(string cacheName, string region)
    DataCacheServerEndpoint[] endpoints = new DataCacheServerEndpoint[] { new DataCacheServerEndpoint("localhost", 22233, "DistributedCacheService") };

    using (DataCacheFactory factory = new DataCacheFactory(endpoints, true, false))  <- Exception
        m_cache = factory.GetCache(cacheName);

    m_region = region;
... I get the following error:
Microsoft.Data.Caching.DataCacheException was unhandled by user code
  Message=ErrorCode<ERRCA0022>:SubStatus<ES0006>:There is a temporary failure, please retry after some time. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. Please ensure security permission has been granted for this client account on cluster and ensure that cache service is allowed through firewall on all cache hosts. Retry later)
       at Microsoft.Data.Caching.DataCacheFactory.Initialize()
       at Microsoft.Data.Caching.DataCacheFactory.CreateCacheFactory(EndpointID[] servers, Boolean routingClient, Boolean localCache, DataCacheLocalCacheSyncPolicy syncPolicy, Int32 localCacheTimeout, Int32 pollInterval, Int64 objectCount, Int32 masterTimeout, TimeSpan channelOpenTimeout, DataCacheSecurity dataCacheSecurity)
       at Microsoft.Data.Caching.DataCacheFactory..ctor(DataCacheServerEndpoint[] servers, Boolean routingClient, Boolean localCache)
       at SolutionForge.FixnetTrader.Services.Analytics.CacheKeyedCollection`1..ctor(String cacheName, String region) in C:\Source\SolutionForge\Order Manager\4.8\Product\Services\Analytics\Analytics\SolutionForge.FixnetTrader.Services.Analytics\CacheKeyedCollection.cs:line 18
       at SolutionForge.FixnetTrader.Services.Analytics.OrderCollection..ctor(String cacheName, String region) in C:\Source\SolutionForge\Order Manager\4.8\Product\Services\Analytics\Analytics\SolutionForge.FixnetTrader.Services.Analytics\CacheKeyedCollection.cs:line 65
       at lambda_method(Closure , ActivityContext )
       at Microsoft.VisualBasic.Activities.VisualBasicValue`1.GetValueCore(ActivityContext context)
       at Microsoft.VisualBasic.Activities.VisualBasicValue`1.TryGetValue(ActivityContext context, TResult& value)
       at System.Activities.InArgument`1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityContext resolutionContext)
       at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityContext resolutionContext, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
       at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
       at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Now, the ASP.Net Development Server is running under my user account from which I am able to maintain the cache using powershell so I would assume its not a permissioning error but I tried "Grant-CacheAllowedClientAccounts" using both "account" and "domain\account" patterns to no avail.

Is anyone else getting this error? I've been banging my head against it for a while now...



I have AppFabric installed and working great caching my ASP.Net Sessions. I'm trying to test the High Availability option. In order to do this, I would like to unplug the network card of the Cache Host were my Session lives and make sure that I can still work.

How can I see a list of the objects in the cache and where the primary/secondary objects "live"?



I have to remove a list of items from the cache and I am trying to retrieve all the cache items in a region from AppFabric, but not getting any of the items. It is returning the Timeout error.

Need an urgent solution.



From what I've read so far AppFabric's caching services (Velocity) are for use with Web applications, can't we use them similarly in our services? WCF and WF based??

If not, why not?

If yes, can we use the same API's as provided for web apps with AppFabric?





Hellow I have following 2 issues in AppFabric Caching

1. Creating SQL Configuration Cluster Configuration

The help given on the installation guide is very unclear, question I have is

 - while Installation the user who is installing will be a domain user who has administrative

 - Do we really need to create to add any users to SQL server which is in the same domain as Velocity server, but the user who is installing the AppFabirc need not have owner permission on DB

- Can some one give the configuration details which they have configured at their end to get this worl.

2.) Turn off security in AppFabric

 - Do we really need to do this ()

 - what all are the cases in which we need this

 - what is the dis-advantage of the same





is it possible to use AppFabric Cache to store (large) files and not just objects?

Thank you

I forgot which video but I was watching videos from the last PDC and someone said that they had cache providers for asp.net and appfabric on codeplex. Does anyone know which codeplex project that is? is it even on there yet?


I have a windows service which creates multiples instances of a workflow service hosted using IIS/Appfabric. Now i want that all these workflow instances should work for my invokation and die out rather than persisting.However i want a specific hashtable to be persisted in cache for each instance which can be identified and retrieved from cache, when i am going to create workflow instance again.

Please let me know if this is possible in appfabric:-

1) To save and retrieve hashtables from appfabric cache by a specific id. e.g.Cache.getHashtable("DealerID")

2) Is this appfabric cache lifetime is only till the workflow instance is in existence or can it maintained beyond that.

Domain problem is:- I create one workflow instance for each dealer in my sales management application. Each workflow instance takes data about dealer details from a hashtable in appfabric cache,processes all the order for one dealer and die out. Next time when more orders come, i will again create instance of workflow, select hashtable from set of hastables( for all dealers) by Dealer id, get dealer details,process all orders for that dealer and die out.

Kindly respond urgent as it have to finalise solution based on this by tomorrow



I have a cache cluster with 2 hosts. I can successfully start the cluster but when I run my IIS 7 app I get the following error:

ErrorCode<ERRCA0017>:SubStatus<ES0001>:There is a temporary failure. Please retry later.

When I look at get-cachehost I see that the service on my lead host is down. From the lead host I look at the log in Event Viewer -> Application and Services Logs -> Microsoft -> Windows -> Application Server-System Service -> Admin and see the following:

<em>AppFabric Caching service crashed with exception {System.Runtime.CallbackException: Async Callback threw an exception. ---> System.IdentityModel.Tokens.SecurityTokenValidationException: The service does not allow you to log on anonymously.
  at System.ServiceModel.Security.SecurityUtils.ValidateAnonymityConstraint(WindowsIdentity identity, Boolean allowUnauthenticatedCallers)
  at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.CreateClientSecurity(NegotiateStream negotiateStream, Boolean extractGroupsForWindowsAccounts)
  at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
  at System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream stream)
  at Microsoft.ApplicationServer.Caching.VelocityStreamSecurityUpgradeAcceptor.AcceptUpgrade(Stream stream)
  at System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection connection, StreamUpgradeAcceptor upgradeAcceptor, IDefaultCommunicationTimeouts defaultTimeouts)
  at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
  at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
  at Microsoft.ApplicationServer.Caching.WcfServerChannel.Listen(IAsyncResult result)
  at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
  --- End of inner exception stack trace ---
  at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
  at System.Runtime.InputQueue`1.AsyncQueueWaiter.Set(Boolean itemAvailable)
  at System.Runtime.InputQueue`1.CompleteWaiters(Boolean itemAvailable, IQueueWaiter[] waiters)
  at System.Runtime.InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread)
  at System.Runtime.InputQueue`1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread)
  at System.ServiceModel.Channels.InputQueueChannelAcceptor`1.EnqueueAndDispatch(TChannel channel, Action dequeuedCallback)
  at System.ServiceModel.Channels.ConnectionOrientedTransportManager`1.OnHandleServerSessionPreamble(ServerSessionPreambleConnectionReader serverSessionPreambleReader, ConnectionDemuxer connectionDemuxer)
  at System.ServiceModel.Channels.ConnectionDemuxer.OnSessionPreambleKnown(ServerSessionPreambleConnectionReader serverSessionPreambleReader)
  at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ContinueReading()
  at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.StartReading(Action`1 viaDelegate, TimeSpan receiveTimeout)
  at System.ServiceModel.Channels.ConnectionDemuxer.OnDuplexConnection(IConnection connection, Action connectionDequeuedCallback, Int64 streamPosition, Int32 offset, Int32 size, TimeSpan timeout)
  at System.ServiceModel.Channels.ConnectionDemuxer.OnConnectionModeKnownCore(ConnectionModeReader modeReader, Boolean isCached)
  at System.ServiceModel.Channels.ConnectionModeReader.ReadCallback(Object state)
  at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)
  at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
  at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)}. Check debug log for more information</em>

There is no firewall between these machines and I know they are communication because I can start and stop the cluster from either machine.

Here is the relevant portions of the cache config:


- <configSections><sectionname="dataCache"type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></configSections>
- <dataCachesize="Small">
- <caches>
- <cacheconsistency="StrongConsistency"name="default">
- <policy><evictiontype="Lru"/><expirationdefaultTTL="10"isExpirable="true"/></policy></cache></caches>
- <hosts><hostreplicationPort="22236"arbitrationPort="22235"clusterPort="22234"hostId="1517955733"size="2048"leadHost="true"account="EXT\machine1$"cacheHostName="AppFabricCachingService"name="r52brweb04"cachePort="22233"/><hostreplicationPort="22236"arbitrationPort="22235"clusterPort="22234"hostId="1350565914"size="2048"leadHost="false"account="EXT\machine2$"cacheHostName="AppFabricCachingService"name="r52brweb05"cachePort="22233"/></hosts>
- <advancedProperties>
- <securityProperties>
- <authorization><allowusers="IIS APPPOOL\App-1"/><allowusers="IIS APPPOOL\App-2"/></authorization></securityProperties></advancedProperties></dataCache></configuration>




We are planning to use AppFabric caching with one of our applications which would use ASP.NET web parts to display user specific information. As the information is user specific, it would obviously vary from user to user

My question is that does AppFabric support user level caching so that my web part run against the cache and not hit the server everytime. If yes, then is there an example of the API using which this could be implemented. If no, then are there any work-arounds for the same.

Thanks for your help




I have succesfully setup an installation of the appfabric cache. When i start the cluster it's bind to my local machine name "hercules" on port 22233.

I also have a development machine in my office on a different location. How can i use the appfabric cache from my work machine? When i startup my webapp on my office machine it can't connect to the hercules machine (hercules is a workgroup computer, behind a router). I tried to enter the ip adress of my router and on the router i forwarded port 22233 to the hercules machine but i can't connect. If i run my webapp on the hercules machine and i use hercules as name for the cache endpoint everything works fine but i also want to debug the source of my webapp on my office location.


Hi all,

Quick question:  I have read that in order for AppFabric cache clustering to work, you actually have to install the services on Windows 2008 Enterprise Servers (why?!?).

My question is this:  If I want to have a distributed cache that is more simply partitioned (i.e. 2 cache servers working together as a single cluster, and having applications read/write objects to them by not using any Regions), does that require Enterprise Server as well?  I don't care about failover and backup of my session objects, but I do have a large number of objects that I wish to partition across multiple servers.  I certainly do not want to pay upwards of $10k to upgrade my Windows servers boxes just to have a segmented/partitioned caching system.

We would really like to start using AppFabric cache, but if MS is going to force us into Enterprise server for a basic partitioned and distributed caching service, we will probably end up having to go with memcached.




I've gone through the wizard to configure Appfabric caching.  I selected XML file and pointed to a share on the network.  The ClusterConfig.xml is created in the share and I see the first Node in there.  However, the Service itself never starts.  It is set to manual and fails to start with this error:

The AppFabric Caching Service service failed to start due to the following error:

A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration.

This is the username that was logged on when the wizard ran.  it is an administrator and has 'Log On As A Service'.  I cannot use Network Service, which is the default because these nodes are not members of any domain.



Working in a virtual environment, where VMs are periodically moved for optimal resources, means that cache servers are temporarily unavailable whilst the move takes place. This can take 15 secs on average, to a minute. I guess that this unavailability could cause problems in time-sensitive cluster health algorithms.

Looking at the DistributedCacheService.exe.config, there is a configuration element called fabric\section "param"\ClusterStableNodeUpInterval, whose value was set to 10 by the installation wizard. 

MSDN says that this value should not normally be touched, but is this value expressed in seconds, milliseconds or another time unit?

How should we expect AppFabric to work in a virtual environment, with dynamic resource control?

Many thanks,

I've got te following exception while trying to configure AppFabric Beta 2 Cache;

"System.Management.Automation.CmdletInvocationException: Windows NT user or group 'TERRA\LOCAL SERVICE' not found. Check the name again. ---> Microsoft.ApplicationServer.Caching.ConfigStoreException: Windows NT user or group 'TERRA\LOCAL SERVICE' not found. Check the name again. ---> System.Data.SqlClient.SqlException: Windows NT user or group 'TERRA\LOCAL SERVICE' not found. Check the name again.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.ApplicationServer.Caching.SqlServerAdmin.CreateNewLogin(String loginName, SqlConnection conn, SqlTransaction tr)
   at Microsoft.ApplicationServer.Caching.SqlServerAdmin.EnsureLoginForSid(Byte[] sid, String loginName)
   at Microsoft.ApplicationServer.Caching.SqlServerCustomProvider.AddUser(String machine, String user)
   --- End of inner exception stack trace ---
   at Microsoft.ApplicationServer.Caching.SqlServerCustomProvider.AddUser(String machine, String user)
   at Microsoft.ApplicationServer.Caching.Configuration.Commands.RegisterCacheHostCommand.SetCustomProviderPermissions(String provider, String connStr, String account, String serviceHost)
   at Microsoft.ApplicationServer.Caching.Configuration.Commands.RegisterCacheHostCommand.BeginProcessing()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.Runspaces.Pipeline.Invoke()
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke()
   at Microsoft.ApplicationServer.Configuration.DistributedCacheProxy.RegisterCacheHost(DistributedCacheSettings settings)
   at Microsoft.ApplicationServer.Configuration.DistributedCacheNodePage.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e)"

What's wrong with my config?

Config environment;
OS            : Windows 7 x64
Language  : TR
Selected caching service account : NT AUTHORITY\Local Service

note that; computer is located within a workgroup.

<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure