1 / 22

AppFabric Caching: How It Works and When You Should Use It

MID302. AppFabric Caching: How It Works and When You Should Use It . Jon Flanders Senior Consultant MCW Technologies. Agenda. Why Caching? What is AppFabric Cache? On-Premise and in Azure Demo, demo, demo. Typical Web Architecture. Problems with typical architecture.

ellery
Download Presentation

AppFabric Caching: How It Works and When You Should Use It

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MID302 AppFabric Caching: How It Works and When You Should Use It Jon Flanders Senior Consultant MCW Technologies

  2. Agenda • Why Caching? • What is AppFabric Cache? • On-Premise and in Azure • Demo, demo, demo

  3. Typical Web Architecture

  4. Problems with typical architecture • Storing session in memory leads to scalability problems • Sticky sessions solve this • Most cloud providers don’t enable • Data tier is difficult to scale out • Portioning is one way • No product gives you this automatically

  5. How do you scale this architecture? • Caching data from the data tier has been one typical pattern • Reduces load on database • Reduces network round-trips • Caching in memory of web tier can lead to cache coherency problems • CEO gets one good financial report from Web Node 1 – refreshes and gets bad financial report from Web Node 2 • One of these is stale

  6. Definitions • Caching • Storing a copy of data closer to application logic, away from its source • Distributed Caching • A set of nodes in a farm that coordinate to create a unified view of a cache to a caching client • Expiration • When an object is removed from the cache because of staleness • Eviction • When an object is removed from the cache due to low memory conditions

  7. What is AppFabric Cache? • A distributed cache for “data” • An in-memory cache (no paging to disk or persistence layer) • The “Data” can be • Any (serializable) CLR Object • XML • Binary data • Optimized for the cache-aside pattern (in this version) • Programming against the cache uses explicit API • Changing the cache doesn’t update the original data store

  8. New Architecture with Caching

  9. Windows *Server* AppFabric Cache • Cache runs on N nodes • Nodes that share configuration are part of a single Cache Cluster • Runs as a Windows Service (one service per server node) • Typically not the same servers as the client (web) tier • More memory is better • In-memory copy cache is optional setting (“Local Cache”) • All the cache nodes in a cluster are part of a fabric • Share configuration • Communicate • Cooperate

  10. Windows *Azure* AppFabric Cache • Essential if you are building Azure Web or Worker roles • APIs are identical • You don’t have to manage cache cluster • Can increase and decrease capacity using configuration rather than physical hosts • 128MB to 4GB per named cache – you don’t lose data when you increase cache size • Normal eviction policies apply if you decrease cache size

  11. AppFabric Cache advantages • Native .NET API • Scalability • Performance • Typically linear as more nodes are added • LocalCache increases raw performance • High Availability • Distributed nature safeguards against cache client and server failures

  12. AppFabric Cache – On Premise and in Azure demo

  13. Current deltas between server and Azure • Some server features not available ATM • No Notifications, HA, Tags/Regions • Expiration • No way to change expiration on a cache –but can be changed on a per-object basis • Eviction • No way to change eviction settings • Connections • Server: one connection ==multiple named caches • Azure: one connection == named default cache • Azure – create multiple namespace reservations

  14. When to use it: • Reference data • Activity data • Resource data

  15. ASP.NET Session State Provider • Included OOB with the Cache • Simple configuration change • Enables session state to be cached across a cluster

  16. Session state provider • <sessionStatemode="Custom"customProvider="SessionStoreProvider"> • <providers> • <addname="SessionStoreProvider"type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider, Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"cacheName="BlueYonderSession"/> • </providers> • </sessionState>

  17. Summary • Windows Server AppFabric Cache is a distributed application cache • Caching is important to application scalability • Explicit caching API available to .NET 3.5 SP1 and .NET 4.0 • ASP.NET Session provider an implicit way to take advantage of the Cache’s capabilities

  18. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • Windows Azure Platform Training Kit • Windows Server AppFabric Training Kit • BizTalk 2010 Developer Training Kit • AppFabric Team Blog • Windows Azure AppFabric on MSDN • Windows Server AppFabric on MSDN

  19. Resources • Connect. Share. Discuss. http://northamerica.msteched.com Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers http://microsoft.com/technet http://microsoft.com/msdn

  20. Complete an evaluation on CommNet and enter to win!

More Related