MIX10 – Day One – Designing and Delivering Scalable and Resilient Web Services

Ron Jacobs – Sr. Technical Evangelist – Microsoft


“Do the simplest thing that will possibly Work”

Scalability – Able to support the required quality of Service as the system load increases – Wiktionary

Typical Web Architecture

  • Users
    • Need a to get routed to same machine (ex. stick sessions)
  • Web Tier
  • Data Tier

Problem: “It’s simple but isn’t scalable”


  • Keep your data near where she’s processing
    • Ex. Cache
    • Cache is scoped to machines / process
      • machine dies
      • processes recycle
    • Cache memory
    • Imagine “What if?”
      • You could have as much cache as you wanted?
      • You could share giant parts of your applications?
      • What about if it was free?
    • You have: Windows Server App Fabric

What is AppFabric Caching?

  • An explicit, distributed, in-memory application cache for all kinds of data
    • Caching clients can be across machines or processes
    • Clients access the cache as if it was a large single cache
      • This creates a Unified Cache View.
    • Doesn’t need to be recycled or recompiled when some other process or machine is added

Data Distribution

  • Scale on Data Size – more machines => more memory to cache
  • Scale on Cache Throughput – more machines => keys are distributed across machines => better throughput
  • It’s better to scale with several machines that with a large machine with lots of memory, because the throughput

Take control over AppFabric Cache using the DataCacheFactory class.


  1. Configure the AppFabric Configuration Store
  2. Copy the Client Dlls
  3. Update the Web.Config to host the AppFabric Caching


  • Clients: .NET 4.0 and 3.5
  • Cache Server: .NET 4.0


  • PowerShell commands
    • get-CacheHelp
  • Performance Counters

AppFabric Cache Codeplex Tool – http://mdcadmintool.codeplex.com


  • Domain-Based Security Option
    • Domain Account / Load Account based Authentication
    • Only authorized servers can join the clusters

AppFabric Caching Logical Hierarchy

Machine –> Cache Host –> Named Caches –> Regions –> Cache Items –> Objects

  • Host
    • Physical processes hosting AppFabric Caching instance
  • Named Caches
    • Can span across machines
  • Regions
    • Groups that you want to treat together

Types of Data

  • Reference Data
    • Primary Read Only
    • ex. Catalog Data
  • Activity Data
    • Read-Write not shared
    • Ex. Shopping cart
  • Resource Data
    • Read-write and Shared
    • Ex. Auction Data / Seat Assignment

Reference Data

  • Performance
    • Catalog data doesn’t change often
    • Unnecessary network cost to access from different machines
    • Solution – Local Cache
  • Bulk Get
    • Bulk Fetch from region
      • 200-300k of calls per second
      • better performance

Activity Data

  • Session Integration
    • Just define SessionState to Custom mode and use the “SessopmStoreProvider” to use AppFabric Caching
  • Availability
    • It’s possible to define AppFabric Caching to use High Availability and replicate the cached data

Resource Data

  • Optimistic Locking
    • GetCacheItem returns a version object
    • Every update to an object internally increments it’s version
    • Supply the version obtained along with the Put/Remove
  • Pessimistic Locking
    • GetAndLock return a lock handle
    • Doesn’t lock the Get

Resource and Activity Data

  • Get Cache Events Notifications
  • Register on any client to notify changes
  • Batched Notifications

Scalable Notifications

  • Register the notification for a specific key
  • Map keys to partition
  • Poll Required nodes
  • Nodes return list of changes

How to get this

  • Use at the Web Platform Installer, on the Options to enable the Enterprise Tab
  • Afterwards just select the Enterprise tab and install it

View the endpoint.tv Shows Channel 9

Leave a Reply

Your email address will not be published. Required fields are marked *