module 1 windows appfabric cache n.
Skip this Video
Loading SlideShow in 5 Seconds..
Module 1–Windows AppFabric Cache PowerPoint Presentation
Download Presentation
Module 1–Windows AppFabric Cache

Loading in 2 Seconds...

play fullscreen
1 / 25

Module 1–Windows AppFabric Cache - PowerPoint PPT Presentation

  • Uploaded on

Module 1–Windows AppFabric Cache. Introduction and Architecture. Outline. Why caching? Introduction to Windows Server AppFabric Cache Overview of Cache features. Typical Web Architecture. Why use caching?. Most applications end up needing Robustness Speed Scalability

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Module 1–Windows AppFabric Cache' - zephania-estrada

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
module 1 windows appfabric cache

Module 1–Windows AppFabric Cache

Introduction and Architecture

  • Why caching?
  • Introduction to Windows Server AppFabric Cache
  • Overview of Cache features
why use caching
Why use caching?
  • Most applications end up needing
    • Robustness
    • Speed
    • Scalability
  • This is especially true in the web world
    • Need to scale can sneak up quickly
  • Almost any web application can benefit from caching
    • Services can benefit as well
core caching concepts
Core caching concepts
  • 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
what is the appfabric cache
What is the AppFabric Cache?
  • A Distributed cache for “data”
    • In-memory cache
    • Uses an explicit API
  • The “Data” can be
    • CLR Object
    • XML
    • Binary data
  • Optimized for the cache-aside pattern in this version
    • Programming against the cache is explicit
    • Changing the cache doesn’t update the original data store
what is windows server appfabric
What is Windows Server AppFabric?
  • A set of technologies and capabilities integrated into Windows Server and IIIS
    • Designed to make building, managing, and scaling IIS applications easier
  • Ships as part of Windows Server AppFabric 2010 Wave 1
    • Part of Windows Server
    • HA requires Windows Server 2008 Enterprise or DataCenter Editions.
    • Requires .NET 4.0






appfabric architecture
AppFabric architecture
  • 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
    • Same algorithms that support Windows Azure’s fabric
stripped memory across server nodes
Stripped memory across server nodes










Objects in memory

appfabric cache advantages
AppFabric Cache advantages
  • Native .NET API
  • Scalability
  • Performance
    • Typically linear as more nodes are added
    • LocalCache increases raw performance
  • High Availability
    • Distributed nature safe guards against cache client and server failures
installation and configuration
Installation and configuration
  • Installs as part of Windows Server AppFabric
    • Not dependent on other AppFabric features (e.g. service and workflow management)
  • First node creates cluster configuration
    • Other nodes are configured to just join existing cluster
    • Nodes can be added to or removed from the cluster at any time – cluster automatically reconfigures itself
cache cluster configuration
Cache Cluster configuration
  • Configuration abstracted behind a provider model
  • OOB providers
    • SQL Server Database
    • Network share(XML file)
  • Configuration Provider model open
cache size configuration
Cache size configuration
  • You must configure “projected” size
    • 1-5 nodes (small)
    • 6-15 nodes (medium)
    • > 15 nodes (large)
  • Cache optimizes itself based on this setting
  • Setting not affected by actual number of nodes added to cluster
  • You can change this (and other) configuration settings on a stopped cluster
  • PowerShell cmdlets are used to administer the cache cluster

Remember – PowerShell can also be called from .NET Code!

cache creation
Cache creation
  • Caches are named constructs
    • Multiple items can live in one named cache
    • Key for each item must be unique
  • Partition design based on
    • High availability requirements
    • Grouping based on logic
  • New-Cache cmdlet
  • Each named Cache can have its own settings for
    • Availability
    • Expiration
    • Eviction
cache clients
Cache Clients
  • Rich API
    • Centers around the DataCache type
  • Can be .NET 4.0 or .NET 3.5 SP1
    • WCF NetTcpBinding used under client API
  • Can be configured in code or config
    • Simple configuration – server name and port
    • Can configure N servers
    • Configuring max N is recommended
  • Client is “smart”
    • Requests routes to cache node where data lives automatically
    • Routing table updated on a constant basis by cache cluster
    • Client essentially becomes part of the cluster fabric
  • Local cache configured at client
    • Local cache automatically updated (no guaranteed speed)
programming the cache
Programming the cache

//create DataCacheFactory based on config file

var dcf = newDataCacheFactory();

//get the cache named "TestCache"

var cache = dcf.GetCache("TestCache");

//Add an item called "Test" - throws if exists

cache.Add("Test", newData { TheData = "Test" });

//Put an item called "Test2" - overwrites if exists

cache.Add("Test2", newData {TheData = "Test2" });

//Get "Test3" - add if not in cache (cache-aside)

var test3 = cache.Get("Test3") asData;

if (test3 == null)


test3 = newData {TheData = "Test3" };

cache.Add("Test3", test3);


client api
Client API
  • Clients can specific named Regions for items
    • Regions are stored on one cache host only
    • Created implicitly if not specified
  • Cache Items can be tagged
    • Tagging enables items to be retrieved without specific knowledge of the item
  • Client can register for notification of cache events
    • Bulk API available as well
  • Domain Based Security Option
    • On by default
    • Domain Account / Local Account based Authentication
    • Only authorized servers can join the cluster
    • Only authorized clients can connect to the cluster
  • Transport Level Security
    • Turn on/off Signing or Encryption
  • Can turn off Cache Security
    • Security always has a performance implication
    • Use Firewalls, IPSec, VLANs to protect cache

grant-cacheallowedclientaccount  MyDomain\Machine1$

grant-cacheallowedclientaccount  MyDomain\Jon

  • PowerShell enables configuration and some monitoring
  • Logging
    • Cache participates in ETW tracing
    • Logging available on both client and server
  • Rich set of performance monitor counters for monitoring both cache and host performance
asp net session provider
ASP.NET Session Provider
  • Custom Session Provider included with Cache
  • Just a configuration change
    • enables session state to be cached across a cluster
    • You may want to enable HA on the cache used



<addname="SessionStoreProvider"type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider, Microsoft.ApplicationServer.Caching.Client, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"cacheName="BlueYonderSession"/>



caching patterns
Caching Patterns
  • It is extremely useful to classify the type of data you are going to cache as either:
    • Resource, Activity, or Reference Data
  • Classification will inform what features to use
    • Use the correct feature for the correct type of data
    • Will help you to design the property number of caches
    • i.e. No need for HA for Reference data
  • More on this later
  • 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