Your SlideShare is downloading. ×
0
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Azure appfabric caching intro and tips
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Azure appfabric caching intro and tips

5,922

Published on

Introduction, Gotchas and Guidelines while using Windows Azure AppFabric Caching service. …

Introduction, Gotchas and Guidelines while using Windows Azure AppFabric Caching service.

Published in: Technology
2 Comments
0 Likes
Statistics
Notes
  • Thanks, glad that it was useful.
    See if these links help http://bobthegoblin.wordpress.com/2011/09/05/working-around-windows-azure-appfabric-cache-timing-out-with-large-amounts-of-data/
    http://blogs.msdn.com/b/akshar/archive/2011/05/01/azure-appfabric-caching-errorcode-lt-errca0017-gt-substatus-lt-es0006-gt-what-to-do.aspx

    Also make sure you are not testing it only on the emulator deploy and try it on Azure too, sometimes there are firewall issues connecting to caching service from on premises.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • the slide very useful but i want to know how to solve below problem as in the slide: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total Views
5,922
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
31
Comments
2
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Azure App Fabric Caching Sachin Sancheti sachin@cumulux.com www.cumulux.com www.cumulux.com Page 1
  • 2. • Introduction to Azure App Fabric Cache• Configuration and Usage• Session State Provider Gotchas• Tracing• Understanding Quota & Common Errors• Local Cache option• Limitations of Azure Appfabric Cache• Guidelines www.cumulux.com Page 2
  • 3. • The Caching service – is a distributed, in-memory, application cache that can be used to accelerate the performance of Windows Azure applications – Provided as “PaaS” – Built on top of Windows Server Appfabric Cache (Velocity)• Caching Usage – Frequently Accessed Data Caching – ASP.Net Session State – ASP.Net Output Caching www.cumulux.com Page 3
  • 4. • Configuration (.config) – Portal Demo • Login to Windows Azure Portal • Create/Select the cache namespace • Click on View Client Configuration • This configuration provides instructions to configure Azure AppFabric caching for data caching – Session State Provider – Output Caching – .config based configuration www.cumulux.com Page 4
  • 5. • Configuration (Code) – Code Block – // Declare array for cache host. DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1]; – servers[0] = new DataCacheServerEndpoint("demo101.cache.windows.net", 22233); – // Setup DataCacheSecurity configuration. – string strACSKey = "<copy and paste security key from Azure portal or from the client configuration file>"; – var secureACSKey = new System.Security.SecureString(); – foreach (char a in strACSKey) – { – secureACSKey.AppendChar(a); – } – secureACSKey.MakeReadOnly(); – DataCacheSecurity factorySecurity = new DataCacheSecurity(secureACSKey); – // Setup the DataCacheFactory configuration. – DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration(); – factoryConfig.Servers = servers; factoryConfig.SecurityProperties = factorySecurity; – // Create a configured DataCacheFactory object. – DataCacheFactory cacheFactory = new DataCacheFactory(factoryConfig); – // Get a cache client for the default cache. – DataCache defaultCache = cacheFactory.GetDefaultCache(); – // Add and retrieve a test object from the default cache. – defaultCache.Add("key", "valueobject"); – string strObject = (string)defaultCache.Get("key"); www.cumulux.com Page 5
  • 6. • Usage Only one instance of – Data Cache (Explicit) DataCache is created per instance of DataCacheFactory cacheFactory = new DataCacheFactory(); DataCacheFactory and dataCache = cacheFactory.GetDefaultCache(); GetDefaultCache() returns back the dataCache.Add(“key”,object,[Timeout]); same instance each Object o = dataCache.Get(“key”); time – ASP.Net Session State (Implicit) • .config DistributedCacheSessionStateStoreProvider – ASP.Net Output Caching (Implicit) • .config DistributedCacheOutputCacheProvider One DataFactory instance used per role instance www.cumulux.com 2 Page 6
  • 7. • Expiration – By default, items in a Windows Azure AppFabric cache do not expire – We can explicitly set a timeout while adding an item into the cache• Eviction – When exceeds maximum cache size, the least recently used items in the cache are evicted www.cumulux.com Page 7
  • 8. • Configuration <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider"> <providers> <add name="AppFabricCacheSessionStoreProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" useBlobMode="true“ applicationName=“demo101” dataCacheClientName="default" /> </providers> </sessionState>• Gotchas • By default, site name is considered as applicationName – Causes issue in Development Emulator due to different site names for multiple instances • Avoid temptation to change useBlobMode to “false” – Microsoft Support declared it unsupported for Windows Azure www.cumulux.com Page 8
  • 9. • Client Side Tracing – <dataCacheClient> <tracing sinkType="DiagnosticSink" traceLevel="Verbose"/> <!-- ... --> </dataCacheClient>• Request Tracking – Used by Microsoft Support to diagnose unexpected failures – Enabling Client Side Tracing is a must – Each request to the Windows Azure Appfabric cache has a request identifier (GUID) attached to it. This request identifier is available from the client-side logs www.cumulux.com Page 9
  • 10. • 128 MB cache for $45.00/month• 256 MB cache for $55.00/month• 512 MB cache for $75.00/month• 1 GB cache for $110.00month• 2 GB cache for $180.00/month• 4 GB cache for $325.00/month www.cumulux.com Page 10
  • 11. • Memory Quota – Cache Size selected/updated for consumption – Surpass Situation • After maximum size is reached the cache item eviction would happen with LRU algorithm www.cumulux.com Page 11
  • 12. Bandwidth• Network Quota Cache Size Transactions Per Hour MB Per Concurrent Connections• Transactions (Reset every hour) Hour• Bandwidth (Reset every hour) 128MB 400000 1400 5• Concurrent Connections (Static) 256MB 800000 2800 10 512MB 1600000 5600 20 1GB 3200000 11200 40 2GB 6400000 22400 80• Surpass Situation 4GB 12800000 44800 160 – Transactions & Bandwidth • Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0009>:There is a temporary failure. Please retry later. (The request failed because user exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one) – Connections • ErrorCode<ERRCA0017>:SubStatus<ES0009>:There is a temporary failure. Please retry later. (The request failed, because you exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one). Additional Information : Throttling due to resource : Connections. www.cumulux.com Page 12
  • 13. • Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0009>:There is a temporary failure. Please retry later. (The request failed because user exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one)• ErrorCode<ERRCA0017>:SubStatus<ES0009>:There is a temporary failure. Please retry later. (The request failed, because you exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one). Additional Information : Throttling due to resource : Connections.• ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.) www.cumulux.com Page 13
  • 14. • Faster Cache – Cache object is served from the local cache (if exists ) and saves a round trip to AppFabric Cache Server• Configuration – <dataCacheClients> <dataCacheClient name="default"> <localCache isEnabled=“true" ttlValue="300" objectCount="10000"/> ……. </dataCacheClient>• Supports only TimeoutBased cache invalidations. As of now doesn’t support NotificationBased cache invalidations www.cumulux.com Page 14
  • 15. • The maximum size of a post-serialized object is 8 MB• Notifications – Notifications are not supported in Windows Azure AppFabric Caching. This also means that you cannot use notifications to invalidate the local cache. In Windows Azure AppFabric, local cache can use only a timeout based invalidation policy• Regions and Tags – Windows Azure AppFabric Caching does not support user-created regions or tag-based searches• No support for Named Cache – Supports only GetDefaultCache• No Clear All• No Get All www.cumulux.com Page 15
  • 16. • Avoid only “Cache Size Based” selection, also consider bandwidth and connection quota too• Implement Cache Aside Model – Due to Eviction policy applications should be designed to anticipate that items might be missing and require reloading at any time. • Decorator pattern might come handy in such scenarios where one class implements the storage with AppFabric Cache and the decorator does it for persistent storage• Carefully Enable LocalCache – Since it doesn’t support Notifications, application might get stale data – Generally used for reference data e.g. Country Names, Zip Codes etc.• DataCacheFactory – Fewer the cache factories recreated better is the performance – Do not let the DataCacheFactory object get disposed. The life of the DataCache object is tied to the DataCacheFactory object – Only one instance of DataCache is created per instance of DataCacheFactory and GetDefaultCache() returns back the same instance each time www.cumulux.com Page 16
  • 17. • Plan for Quotas – Transaction, Bandwidth Limits • Implement Cache Aside Policy • Be aware while load testing and plan accordingly – Connection Limits • Each DataCacheFactory can create a number of connections. By default, a single DataCacheFactory will only create one connection • maxConnectionsToServer – Specifies the maximum number of channels to open to the cache cluster – <dataCacheClient name="default" maxConnectionsToServer=“2"> • Singleton implementation would help implement one connection per web role instance for DataCacheFactory • Do not forget the implicit connections consumed by providers (Session and Output Cache providers) www.cumulux.com Page 17
  • 18. Q&A Thank Youwww.cumulux.com Page 18

×