scale your data tier using windows server appfabric caching formerly project velocity n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Scale Your Data Tier using Windows Server AppFabric Caching (formerly Project “ Velocity ”) PowerPoint Presentation
Download Presentation
Scale Your Data Tier using Windows Server AppFabric Caching (formerly Project “ Velocity ”)

Loading in 2 Seconds...

play fullscreen
1 / 57

Scale Your Data Tier using Windows Server AppFabric Caching (formerly Project “ Velocity ”) - PowerPoint PPT Presentation


  • 150 Views
  • Uploaded on

PDC09-FT26. Scale Your Data Tier using Windows Server AppFabric Caching (formerly Project “ Velocity ”). Muralidhar Krishnaprasad Principal Software Architect Microsoft Corporation. Grocery Web Site. Typical Architecture. Users. Load Balancer Sticky Routing. Application / Web Tier.

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

PowerPoint Slideshow about 'Scale Your Data Tier using Windows Server AppFabric Caching (formerly Project “ Velocity ”)' - lorna


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
scale your data tier using windows server appfabric caching formerly project velocity
PDC09-FT26

Scale Your Data Tier using Windows Server AppFabric Caching(formerly Project “Velocity”)

Muralidhar Krishnaprasad

Principal Software Architect

Microsoft Corporation

typical architecture
Typical Architecture

Users

Load Balancer

Sticky Routing

Application

/ Web Tier

Application

Application

Application

ASP.Net App

Session Cart Hosted in memory

Catalog sits in Database

Data Tier

Database

and then
And then…

Flu Hits!

you become a popular grocer
You become a popular Grocer!

Web Site’s too slow!!

Users

Where did my shopping cart go?

Web Tier

(ASP.Net)

Application

Application

Application

Servers are crashing

Database is hot!!

Data Tier

Database

outline
Outline
  • The Problem!
  • Caching with the Windows Server AppFabric
    • What is it?
    • Why AppFabric caching?
    • What stage is it in?
  • Overview and Programming
  • Caching Futures
  • Conclusions
what is appfabric caching
What is AppFabric Caching?
  • An explicit, distributed, in-memory application cache for all kinds of data
    • (CLR objects, rows, XML, Binary data etc.)
    • Fuse "memory" across machines into a unified cache

Caching clients can be across machines or processes

Clients Access the Cache as if it was a large single cache

Unified Cache View

Cache Layer distributes data across the various cache nodes

where does it fit
Where does it fit?

Users

Web Tier

(ASP.Net)

Application

Application

Application

Caching Access Layer

Caching Access Layer

Caching Access Layer

Caching Service

Caching Service

Caching Service

Cache Tier

Data Tier

Database

Cloud

outline1
Outline
  • The Problem!
  • Caching with the Windows Server AppFabric
    • What is it?
    • Why AppFabric caching?
    • What stage is it in?
  • Overview and Programming
  • Caching Futures
  • Conclusions
why use appfabric caching
Why use AppFabric Caching?

1. Share Data Across Applications

No more sticky routing

2. Performance

3. Scale out by adding more boxes

4. High Availability Protect from Web & Cache Server Failure

why use appfabric caching1
Why use AppFabric Caching?

5. Proven Technology

Associated Press Custom News live on CTP3

  • AppFabric caching capabilities caches metadata and news for widgets
  • Serves 16 million hits per day
  • Increased the amount of cached data 6 times.
why appfabric caching
Why AppFabric Caching?

5. Proven Technology Contd..

  • Dell.com uses AppFabric caching!
    • Channel Partner Portal uses AppFabric caching
      • Provides targeted content and search results
      • Tracks customer browse history and downloads.
    • Next Generation Sales Platform Solutions to use AppFabric caching (currently under construction)
  • Just two of the many TAP customers in line for production
why appfabric caching best yet
Why AppFabricCaching? – Best yet

6. Do all this at low cost!

.

  • Use inexpensive commodity hardware
  • Ships as part of Windows Server AppFabric 2010 Wave 1

* Different Features of the cache might require higher level SKUs of Windows Server.

AppFabric

MONITORING

WORKFLOW HOSTING

CACHING

ACCESS CONTROL

SERVICE HOSTING

SERVICE BUS

MANAGEMENT

MULTI-TENANT

SCALE OUT

  • HIGH AVAILABILITY
outline2
Outline
  • The Problem!
  • Caching with the Windows Server AppFabric
    • What is it?
    • Why caching?
    • What stage is it in?
  • Overview and Programming
  • Caching Futures
  • Conclusions
when can i get windows server appfabric

Azure CTP

  • Post RTM
  • RTM
  • 2010 Wave 1
    • * CY10
When Can I Get Windows Server AppFabric ?
  • CTP2
    • PDC ‘08
  • CTP1
  • June ‘08
  • CTP3
    • Mar ‘09
  • Beta
    • PDC
    • Nov ‘09

(Formerly Called “Velocity”)

outline3
Outline
  • The Problem
  • Caching with the Windows Server AppFabric
  • Overview and Programming AppFabric Caching
    • Deployment & Access API
    • How does AppFabric Caching Scale?
    • Features
  • AppFabric Caching Futures
  • Conclusions
deployment
Deployment

Users

Copy Client DLLs and add app.config

<hosts>

<host name="BL1CDB8083714“

cachePort="22233"

cacheHostName="DistributedCacheService"/>

…..

</hosts>

<localCacheisEnabled=“true" ../>

<security … />

Caching Access Layer

Caching Access Layer

Web Tier

Caching Service

Caching Service

Caching Service

Enable Application Server Cache Role

Cache Tier

Configuration Store

(Can be database, File share, etc.)

Stores Global Cache Policies

Stores Current Partitioning Information

Application

Application

Application

Caching Access Layer

security new in beta
Security (new in Beta)
  • Domain Based Security Option
    • 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
    • Use Firewalls, IPSec, VLANs to protect cache

grant-cacheallowedclientaccount  RedDomain\Machine1$

grant-cacheallowedclientaccount  RedDomain\John

administration monitoring
Administration & Monitoring
  • Centralized administration through powershell
  • Perfmon to monitor the cache (new in Beta)
  • Logging
    • Default ETW, support for file logs
appfabric caching api
AppFabric Caching API

// Create instance of cachefactory (reads appconfig)

DataCacheFactory fac = new DataCacheFactory();

// Get a named cache from the factory

DataCache catalog = fac.GetCache("catalogcache");

// Simple Get/Put

catalog.Put("toy-101", new Toy("Puzzle", .,.));

// From the same or a different client

Toy toyObj = (Toy)catalog.Get("toy-101");

// Region based Get/Put

catalog.CreateRegion("toyRegion");

// Both toy and toyparts are put in the same region

catalog.Put("toy-101", new Toy( .,.), “toyRegion”);

Catalog.Put("toypart-100", new ToyParts(…), “toyRegion”);

Toy toyObj = (Toy)catalog.Get("toy-101“,"toyRegion");

appfabric caching logical hierarchy
AppFabric Caching Logical Hierarchy

AppFabric Caching Service

AppFabric Caching Service

AppFabric Caching Service

AppFabric Caching Service

  • Host
    • Physical processes hosting AppFabric Caching instance.
  • Named Caches
    • Can span across machines
    • Defined in the configuration file
  • Cache Item
    • Key, Payload (Object ), Tags, TTL, Timestamps, Version
  • Regions
    • Physically co-located Container of Cache Items
    • May be implicit or explicitly created

Named Cache : Product Catalog

Named Cache : Electronics Inventory

Regions

Key Payload Tags

Region A

121 xxxx “Toy” “Child”

123 yyyy “Toy” “Chair”..

  • Machine -> Cache Host -> Named Caches -> Regions -> Cache Items -> Objects
access apis tagging items
Access APIs – Tagging Items
  • Add Tags to Items
    • Tag Search on Default Regions (New in Beta)

Tag hotItem = new Tag("hotItem");

catalog.Put("toy-101", new Toy("Puzzle"),

new Tag[]{hotItem}, “toyRegion”);

catalog.Put("toy-102", new Toy("Bridge"), “toyRegion”);

// From the same or a different client

List<KeyValuePair<string, object>> toys =

catalog.GetAnyMatchingTag("toyRegion", hotItem);

usage pattern cache aside explicit caching
Usage Pattern – Cache Aside (Explicit Caching)

// Read from Cache

Toy toyObj = (Toy)

catalog.Get("toy-101");

Application

Caching Access Layer

// If Not present in the cache

if (toyObj == null)

{

// Read from backend..

toyObj = ReadFromDatabase();

// Populate Cache

catalog.Put("toy-101", toyObj);

return toyObj;

}

Caching Service

Database

outline4
Outline
  • The Problem
  • Caching with the Windows AppFabric
  • Overview and Programming AppFabric Caching
    • Deployment & Access API
    • How does AppFabric Caching Scale?
    • Features
    • Demo
  • AppFabric Caching Futures
  • Conclusions
data distribution partitioned cache
Data Distribution - Partitioned Cache

Users

Web Tier

ASP.Net App

ASP.Net App

ASP.Net App

Caching Client

Caching Client

Caching Client

G

H

I

D

E

F

A

B

C

Cache Service

Cache Service

Cache Tier

Cache Service

E

G

B

D

H

A

I

C

F

Scale on Data Size - More machines => More memory to cache

Scale on Cache Throughput - More machines => keys distributed across more machines => better throughput

scale test output
Scale Test Output

Server 3 Added

Throughput Increases

Latency Decreases

Load

Server 2 Added

Throughput Increases

Latency Decreases

Until Server Saturation

Single Server

Throughput Increases with Increasing Load

Until Server Saturation

Throughput

Latency

griddynamics blog engine tests
GridDynamics Blog Engine Tests

More info at http://blogs.msdn.com/velocity/ or

http://www.griddynamics.com/velocity

outline5
Outline
  • The Problem
  • AppFabric Caching – The Solution
  • Understanding Cache Data
  • Overview and Programming AppFabric Caching
    • Deployment & Access API
    • How does AppFabric Caching Scale?
    • Features
    • Demo
  • AppFabric Caching Futures
  • Conclusions
use the right features
Use the right features!
  • Classify your data
    • Reference or Activity or Resource Data
  • Examine Requirements
    • Performance - Throughput & Latency
    • Consistency – Tolerable staleness
    • Eviction - Is the data evictable?
    • Security - Is there any secure data?
    • Availability – Survive node or cluster failures?
types of data
Types of Data

Grocery Shop

Web Tier

Shopping Cart

Grocery Inventory

Distributed Cache

Grocery Catalog

reference data performance
Reference Data – Performance
  • Catalog data doesn’t change often
  • Unnecessary network cost to access from different machines
  • Solution – Local Cache

Application

Application

Get(K2)

Get(K2)

Put(K2, v3)

AppFabric Caching Client

AppFabric Caching Client

Local Cache

RoutingTable

Routing Table

Cache2

Cache3

Cache1

K2, V2

K2, V2

Primary for K1,V1

Primary for K3,V3

Primary for K2,V2

K1, V1

K2, V3

K3, V3

reference data bulk get
Reference Data – Bulk Get
  • Enumerate all items in Region
  • Bulk Fetch from region (New in Beta)
    • 200-300k ops per second

Catalog.BulkGet(

new List<string>(){“toy-101”, “toy-102”} ,

“toyRegion”);

activity data session cart integration
Activity Data – Session Cart Integration

Load Balance Requests

No more sticky routing

<sessionState mode="Custom“ customProvider="SessionStoreProvider">

<providers>

<add name="SessionStoreProvider"

type=“Microsoft.Data.Caching.DataCacheSessionStoreProvider,

ClientLibrary“

cacheName="<YourNamedCache>"/>

</providers>

</sessionState>

Drop in AppFabric Caching SessionStoreProvider

Caching Access Layer

Caching Access Layer

Session State stored in AppFabric Caching

New in Beta – Allow session state to be shared amongst multiple applications

Scale your Session Store

Dynamically

Cache Service

Caching Service

Caching Service

Highly Available

Application

Application

Application

Caching Access Layer

activity data availability
Activity Data - Availability

Application

Application

PUT

Get(K2)

AppFabric Caching Client

AppFabric Caching Client

Routing Table

Routing Table

Cache1

Cache2

Cache3

Primary for

Primary for

Primary for

Replication Agent

K3, V3

K1, V1

K2, V2

(K2, V2)

K2, V2

Secondary for

Secondary for

Secondary for

K2, V2

K3, V3

K1, V1

resource data optimistic locking
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
  • Put/Remove will succeed only if the passed in version matches the version in the cache

Two clients access the same item

Both update the item

Second Client gets in first; put succeeds because item version matches; atomically increments the version

First client tries put;

Fails because the versions don’t match

resource data pessimistic locking
Resource Data - Pessimistic Locking

Client1:

GetAndLock ("k1")

Client3:

Get ("k1")

Client2:

GetAndLock ("k1")

  • New in Beta – Take locks on non-existent keys
    • Allows you to co-ordinate creating new object amongst multiple clients

GetAndLock gets lock handle

Regular Get succeeds

Other GetAndLock on same item fails

K1

resource activity data tracking changes
Resource/Activity Data – Tracking Changes
  • Cache Event notifications
  • Register on any client to notify changes
  • Batched Notifications – (New in Beta)

DataCache.RegisterCacheLevelCallback(

int filter, DataCacheChangeCallback delegate);

DataCache.RegisterRegionLevelCallback(

String region, int filter, DataCacheChangeCallback delegate);

DataCache.RegisterKeyLevelCallback(

String region, String key, int filter, DataCacheChangeCallback delegate);

scalable notifications
Scalable Notifications

Register Notification for Key “K3"

Call Delegate

Store Last LSN

Map Keys to Partition (say P2)

Application

AppFabric Caching Client

Partition: P2

Last LSN: 19

Routing Table

Poll Required Nodes

Nodes Return List of Changes

LSN Order

Cache2

Cache3

Cache1

K2, V2

Primary for

Primary for

Primary for

Change Log (Partition P2)

Del K32

Del K43

Change Log

Partition P1

Add K2

Del K32

Change Log

33 Add K1

34 Del K22

K1, V1

K3, V3

outline6
Outline
  • The Problem
  • AppFabric Caching – The Solution
  • Understanding Cache Data
  • Overview and Programming AppFabric Caching
    • Deployment & Access API
    • How does AppFabric Caching Scale?
    • Features
    • Demo
  • AppFabric Caching Futures
  • Conclusions
outline7
Outline
  • The Problem
  • AppFabric Caching – The Solution
  • Understanding Cache Data
  • Overview and Programming AppFabric Caching
  • AppFabric Caching Futures
    • AppFabric Caching and Azure Platform
    • ASP.Net and Persistance
  • Conclusions
application growth
Application Growth
  • You are a popular Grocer!!
    • Lots of Users!
  • Irregular & Elastic Demands
  • Solution - Move to the Services World!
    • Application on-premise with data on SQL Azure
    • Application on Windows Azure with data on SQL Azure
    • Application on Windows Azure with on-premise database connected by AppFabric Service Bus
app on premise data on sqlazure
App on-premise; Data on SQLAzure

ASP.Net Web Tier

Application

Application

Application

AppFabric Caching Access Layer

AppFabric Caching Access Layer

AppFabric Caching Access Layer

Application & AppFabric Caching deployed On-premise

Caching Service

Caching Service

Caching Service

Caching Worker Role

Data on SQL Azure

app on windows azure data on sql azure
App on Windows Azure; Data on SQL Azure

Web Role

Application

Application

Application

AppFabric Caching Access Layer

AppFabric Caching Access Layer

AppFabric Caching Access Layer

Application & AppFabric Caching on Windows Azure

Caching Service

Caching Service

Caching Service

Caching Worker Role

AppFabric Caching Worker Role

Data on SQL Azure

app on windows azure data on premise
App on Windows Azure; Data on-premise

Web Role

Application

Application

Application

AppFabric Caching Access Layer

AppFabric Caching Access Layer

AppFabric Caching Access Layer

AppFabric Service Bus

Application & AppFabric Caching on Windows Azure

Caching Service

Caching Service

Caching Service

Caching Worker Role

AppFabric Caching Worker Role

Data on-premises

outline8
Outline
  • The Problem
  • AppFabric Caching – The Solution
  • Understanding Cache Data
  • Overview and Programming AppFabric Caching
  • AppFabric Caching Futures
    • AppFabric Caching and Azure Platform
    • ASP.Net and Persistance
  • Conclusions
i ntegration with asp net
Integration with ASP.Net
  • ASP.Net extends cache surface .Net 4.0
  • Integrate with the Application Cache
    • System.Runtime.Caching namespace
    • AppFabric Caching will be a provider for this namespace
  • Granular Session Updates
    • IPartialSessionState lists keys changed
  • Extensible Output Cache Provider
    • Output Caching not limited to single node
future c a che through
Future – Cache Through
  • Callback for read-through, write-behind
  • Specified at Named Cache Level
  • Read-Through
    • Called when item not present in cache
    • Callback returns the object/serialized bytes
  • Write-Behind
    • Writes to cache are queued
    • Callback called asynchronously in batches
    • Re-tries upon failure
  • Bulk Access APIs
hpc integration
HPC Integration

Final Results Store

AppFabric Caching

Central Market Data Store

(~1 TB Tick Data)

Market Data

Final

Results

AppFabric Caching

Intermediate

Store

Market Data

Scratch

Job

Input

Rollup

Operation

Split

Method

Scratch

Keys

Calculation

Operation

GridDynamics testing

on CTP1

50 times improvement

in some cases

outline9
Outline
  • The Problem
  • AppFabric Caching – The Solution
  • Understanding Cache Data
  • Overview and Programming AppFabric Caching
  • Deployment and Maintenance
  • AppFabric Caching Futures
  • Conclusions
additional resources
Additional Resources
  • Related Talks
      • PDC09-FT25 Microsoft Application Server Technologies: Present and Future
    • PDC09-FT18 Microsoft ASP.NET Futures
  • Hands On Labs
    • Introduction to Microsoft Project Code Name “Velocity”
  • On the Web
  • Windows Server AppFabric Developer Center
    • http://msdn.microsoft.com/appfabric
slide53

YOUR FEEDBACK IS IMPORTANT TO US!

Please fill out session evaluation forms online at

MicrosoftPDC.com

learn more on channel 9
Learn More On Channel 9
  • Expand your PDC experience through Channel 9
  • Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learn

Built by Developers for Developers….

slide55

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.