AppFabric QuickStart

  1. Install AppFabric from http://msdn.microsoft.com/windowsserver/ee695849, use all defaults, only install Cache Service
  2. Go to Cache Power Shell and enter new cache
     New-Cache -cacheName Catalog
  3. Start AppFabric service in services.msc
  4. Run command Start-CacheCluster
  5. Add references to cache dlls (found in WINDIR)
    Microsoft.ApplicationServer.Caching.*
  6. .Simple code:
public string GetData(int value)
{
    DataCacheServerEndpoint[] cacheCluster = new DataCacheServerEndpoint[1];
    cacheCluster[0] = new DataCacheServerEndpoint("localhost", 22233);
    DataCacheFactory factory = new DataCacheFactory(new DataCacheFactoryConfiguration
    {
        Servers = cacheCluster,
        MaxConnectionsToServer = 1,
    });
    DataCache cache = factory.GetCache("Catalog");

    cache.Put("Product100", 20);

    object x = cache.Get("Product100");

    Trace.Write("Got the Put x: " + x);

    try
    {
        cache.CreateRegion("Televisions");
    }
    catch (DataCacheException ex)
    {
        if (ex.ErrorCode != DataCacheErrorCode.RegionAlreadyExists)
            throw;
    }

    return string.Format("You entered: {0}", value);
}

 

Known Issues:

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.

Make sure that AppFabric Caching Service is started. Also check firewall

The request failed because the server is in throttled state.

Intermittent issue, can be tracked by enabling the Application and Services logs/Application Server-System Services/Operational (right-click Enable)

Sample warning message found:

Service available memory low – Cache private bytes percent {1} Cache working set percent {1} Cache data size percent {0} Available memory percent {5} CLR Generation2 count {22} Released memory percent {0}.

 

More details: http://msdn.microsoft.com/en-us/magazine/ff714581.aspx

Advertisements

About vijayvepa

I'm a software consultant for Software Specialists Inc. currently working at Philips Respironics, Pittsburgh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: