AppFabric: a large cluster is slower to respond than a small cluster

I am using AppFabric to cache on my website. We recently added more nodes to the cache cluster, and since we are likely to add more to the future [medium], we decided to reconfigure the cluster as a large cluster , not a small one. Now we see some unpleasant side effects, namely AppFabric takes a long time to return after a reboot.

Okay, so if you succeeded, I got your attention and I can tell you the whole story: O). AppFabric always took a long time to return after a reboot, but we were able to configure and code for this so that our users did not see any negative consequences. In web.config we have:

<dataCacheClient channelOpenTimeout="5" requestTimeout="1000" >
    <!-- cache host(s) -->
    <hosts>
        <host name="localhost" cachePort="22233"/>
    </hosts>
</dataCacheClient>

Which (if I misunderstood the documentation) will cause the AppFabric client to throw an exception if it does not receive a response within 1 second. In our code, we process this and return to reading the data we are trying to read directly from the database:

public object Get(object key)
{
    if ( key == null )
    {
        return null;
    }

    try
    {
        return cache[key.ToString()];
    }
    catch ( CacheException ex )
    {
        if ( ex.ErrorCode == DataCacheErrorCode.ConnectionTerminated || ex.ErrorCode == DataCacheErrorCode.RetryLater || ex.ErrorCode == DataCacheErrorCode.Timeout )
        {
            // Calling code should try reading from the database instead
            return null;
        }
        else
        {
            throw;
        }
    }
}

Since we started using a large cluster configuration, it looks like the requestTimeout attribute in the dataCacheClient configuration record is not affected. After issuing the Restart-CacheCluster command, our website stops responding for 3 to 5 minutes, namely, how long it takes for the cluster to return again after a reboot.

, , , - ([ctrl] [f5]) AppFabric . ( - ):

up: 11.4462
: 12.4346
Small Cache: 11.5794
[1]: 14.99

: 11.5534
: 16.576
: 59.4582
[1]: 62.9526

, , , AppFabric.

, , , , , TTL, .

[1] channelOpenTimeout requestTimeout, web.config

+3
1

. , .

DataCache cache; // TODO: initialize
foreach (var regionName in cache.GetSystemRegions())
{
    Trace.WriteLine(string.Format("Enumerating objects in region '{0}'", regionName));
    foreach (var item in cache.GetObjectsInRegion(regionName))
    {
        Trace.WriteLine(string.Format("Removing cache item '{0}'", item.Key));
        cache.Remove(item.Key);
    }
}

1-5 -, Large - 15 -. , , AppFabricCachingService , , , .

+1

All Articles