App fabric introduction

67
Microsoft AppFabric Dennis van der Stelt Tellus

description

AppFabric session I did in the past for SDN

Transcript of App fabric introduction

Page 1: App fabric introduction

Microsoft AppFabric

Dennis van der SteltTellus

Page 2: App fabric introduction

• Tellus– Lead generation– 10k websites– Looking for developers .NET Geeks

• Dennis van der Stelt– http://bloggingabout.net/blogs/dennis/ – http://twitter.com/dvdstelt– [email protected]

Introducing

Page 3: App fabric introduction

Session objectives

Azure AppFabric

Architectural choices

Windows AppFabric

Page 4: App fabric introduction

AppFabric

• Services to build and manage composite applications

• Formerly known as– BizTalk Services– .NET Services– Velocity– Dublin

Page 5: App fabric introduction

Service & Workflow

Management

Caching ServiceBus Access Control

• Workflows• Monitoring• Troubleshooti

ng• Scaling out• Scripting

• Distributed• Enterprise

scale• Load

balancing• ASP.NET

Integration

• Connect• Pass through• Discoverable• REST based

• Claim based• Transformati

on• Security

Token• REST based

Windows ServerAppFabric Azure AppFabric

Page 6: App fabric introduction
Page 7: App fabric introduction

SERVICE & WORKFLOWMANAGEMENT

Windows Server AppFabric

Page 8: App fabric introduction

Brought my own whiteboard

Page 9: App fabric introduction

ClientWCF

Service Database

Hosting services

Host

What are the current hosting capabilities of services?

Page 10: App fabric introduction

ClientWCF

Service Database

Hosting services

Host

#1 – Your own application (Self hosted)

No quality of service

MyApp.exe

Easiest to deploy

Page 11: App fabric introduction

ClientWCF

Service Database

Hosting services

Host

#2 – Windows Service

MyService.exe

Run in background, some monitoringHardly any quality of service

Page 12: App fabric introduction

ClientWCF

Service Database

Hosting services

IIS

#3 – Internet Information Services

MyService.svc

Excellent quality of serviceSupports only HTTP protocol

Page 13: App fabric introduction

ClientWCF

Service Database

Hosting services

WAS

#4 – Windows Process Activation Services

MyService.svc

Excellent quality of service, multiple protocolsNo support for hosting Workflows & true scalability

Page 14: App fabric introduction

Enter Dublin…

Page 15: App fabric introduction

ClientWCF

Service Database

Hosting services

AppFabric

#4 – Service & Workflow Management

MyService.svc

Quality of Service from IIS/WASHosting scalable workflow & WCF Services

Workflow

Page 16: App fabric introduction

Windows Server

.NET Framework

Windows Server AppFabric

Services

Management Tools

IIS/WAS

Workflows

Runtime DatabasesPersistence Monitoring

HostingPersistence CachingMonitoring

IIS Manager Modules

PowerShell

Page 17: App fabric introduction

ScalableShare workflow state across machines

Page 18: App fabric introduction

AppFabric Hosting

Windows Service + AppFabric

Windows Service + AppFabric

Windows Service + AppFabric

PersistenceDatabase

Management Service

Management Service

Management Servicex

Page 19: App fabric introduction

ScalableRetry mechanism for race conditions

Page 20: App fabric introduction

AppFabric Hosting

Windows Service + AppFabric

Windows Service + AppFabric

Management Service

Management Service

Client3F2504E0-4F89-11D3-1337-

Persistence Database

x

Page 21: App fabric introduction

CACHINGWindows Server AppFabric

Page 22: App fabric introduction

Let’s look at a problemyou might experience yourself…

Page 23: App fabric introduction

AppFabric Caching

WebServer

WebServer

WebServer

Load Balancer

Database

Page 24: App fabric introduction

AppFabric Caching

WebServer

WebServer

WebServer

Load Balancer

Database

x

Page 25: App fabric introduction

AppFabric Caching

WebServer

WebServer

WebServer

Load Balancer

Database

Solution is sticky sessions…

Page 26: App fabric introduction

We’ll have uneven load balancing,we might loose sessions,

etc…

Page 27: App fabric introduction

AppFabric Caching

WebServer

WebServer

WebServer

Load Balancer

Database

Another solution is using DBMS to store sessions

Page 28: App fabric introduction

Doesn’t scale well,we’ll have a performance bottleneck.

And clustering is costly andfault sensitive!

Page 29: App fabric introduction

What is AppFabric Caching?• An explicit, distributed, in-memory application

cache for all kinds of data (CLR objects, XML, Binary data, etc.)– Flows "memory" across machines into a unified

cache

Unified Cache View

Clients can be spread across machines or

processes

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

Cache Layer distributes data

across the various cache nodes

Page 30: App fabric introduction

AppFabric Caching

WebServer

WebServer

WebServer

Load Balancer

Database

Page 31: App fabric introduction

Why Velocity?

Operation Throughput

Latency

Read 2k 30,000 / sec

3 – 4 ms

Write 2k 18,000 / sec

3 ms

Operation Servers

Throughput

Read 2k 1 30,000 / secRead 2k 2 58, 600 / secRead 2k 3 85, 500 / sec

Velocity

* Share data across applications No more sticky routing

* Peformance

* Scale out

MSDN Forums5 Velocity Servers, 40GB Cache

98% of all calls to database come from cacheResult is from 60% load on SQL Server, down to 2%

Page 32: App fabric introduction

Basic terminology in Velocity

• Cache host• Cache cluster• Cluster configuration storage• Named cache• Region• Cache item• Tags

Machine 1Cache host A

Cache host B

Machine 2Cache host C

Machine 2Cache host DNamed cache : Product catalog

Named cache : ShoppingCart

Region A

Page 33: App fabric introduction

Working with Velocity// Create instance of CacheFactory, which reads app.config DataCacheFactory factory = new DataCacheFactory();        

// Get a named cache from the factory       DataCache cache = factory.GetCache("default");

// Cache.Put(string key, object value)cache.Add("SDN", new SDNSession()); // Cache.Get(string key);var meeting = (SDNSession)cache.Get("SDN");

// Via indexers is also an optioncache["what"] = new Object();Object o = cache["what"];

Page 34: App fabric introduction

Tagsvar starWarsTag = new DataCacheTag("StarWars");

var tags = new List<DataCacheTag>();tags.Add(starWarsTag);tags.Add(new DataCacheTag("Force"));tags.Add(new DataCacheTag("Sith")); cache.Add("MyKey", "A New Hope", tags, "StarWarsRegion"); var result = cache.GetObjectsByTag(starWarsTag, "StarWarsRegion"); foreach (var item in result){  Console.WriteLine("{0} has value of {1}", item.Key, item.Value);}

Page 35: App fabric introduction

Optimistic lockingDataCacheItemVersion versionWillChange;DataCacheItemVersion versionWithError; // First get the current version 2 timescache.Get("MyKey", out versionWillChange);cache.Get("MyKey", out versionWithError); // We change the key, version hasn't changed in Velocity yet.cache.Put("MyKey", "MyNewValue", versionWillChange); // Version has changed with previous update, this will #failcache.Put("MyKey", "MyErrorValue", versionWithError);

Page 36: App fabric introduction

Pessimistic lockingDataCacheLockHandle lockHandle = null;DataCacheLockHandle secondLockHandle = null; // Lock our objectcache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out lockHandle); // This will still workstring result = (string)cache.Get("MyKey"); // Try to lock for 2nd time -> #failcache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out secondLockHandle); // This will break the lock!!!cache.Put("MyKey", "MyNewValue");

Page 37: App fabric introduction

Notification callbackDataCacheOperation filter = DataCacheOperation.AddItem;cache.AddItemLevelCallback("MyKey", filter, callback);cache.AddRegionLevelCallback("Region", filter, callback);cache.AddFailureNotificationCallback(failCallback); cache.Add("MyKey", "MyInitialValue");

public static void callback (string myCacheName,    string myRegion, string myKey, DataCacheItemVersion itemVersion, DataCacheOperation OperationId,    DataCacheNotificationDescriptor nd){  //display some of the delegate parameters  Console.WriteLine("Region : " + myRegion);  Console.WriteLine("Key : " + myKey);}

Page 38: App fabric introduction

ASP.NET Session integration

• SessionStoreProvider class– Plugs into ASP.NET Session store– Stores session state in Velocity

• Scale– Session information available at all ASP.NET

Nodes• High availability

– Session data is backed up on addditional machines– Resilient to machine or process failures

Page 39: App fabric introduction
Page 40: App fabric introduction

Azure AppFabric

• Webbased services• Yes, in the cloud!• Allow you to easily connect applications

Page 41: App fabric introduction

SERVICE BUSAzure AppFabric

Page 42: App fabric introduction

Azure Service Bus

Page 43: App fabric introduction

Azure Service Bus

Let’s open a port and do some forwarding

Page 44: App fabric introduction

Azure Service Bus

Oh, what about NAT, Proxies, etc?

Page 45: App fabric introduction

Azure Service Bus

Service Bus

Page 46: App fabric introduction

Azure Service Bus

Service Bus

App

Page 47: App fabric introduction

Features

• Services discoverable through SB url• Full duplex channels supporting

bi-directional communiction• Full-duplex p2p sessions

– with network-boundary traversal create direct end-to-end connectivity through NAT

• Multiple publishers & subscribers• REST based (non .NET platform support)

Page 48: App fabric introduction

Azure AppFabric LABShttp://portal.appfabriclabs.com/

Page 49: App fabric introduction

ACCESS CONTROLAzure AppFabric

Page 50: App fabric introduction

Azure Access Control

Service Bus

Federated Identity

Page 51: App fabric introduction

Azure Access Control

Service Bus

Access Control

ID

Page 52: App fabric introduction

Azure Access Control

Service Bus

Access Control

App ID

Page 53: App fabric introduction

Access Control

• Two new protocols– Created by Microsoft, Google, Yahoo, etc– Oauth WRAP & SWT– Authentication in HTTP Headers– Usable even via JavaScript– Ready for Geneva/WIF

Page 54: App fabric introduction

Access Control

• The future• No WS* available yet… or no longer?• CardSpace• Support for other web identity providers

– Windows Live– Google– Yahoo– OpenId

Page 55: App fabric introduction

Azure Pricing

• Access Control– $1.99 / 100K transactions

• Service Bus Connections– $3.99 per connection– $9.99 for a pack of 5 connections– $199 for a pack of 100 connections

• Data Transfers– $0.10 in / $0.15 out per Gigabyte

Page 56: App fabric introduction

Example (real world) architecture

Page 57: App fabric introduction

Example architecture

SQL Website

Page 58: App fabric introduction

Example architecture

SQL Website“Server Busy”

Page 59: App fabric introduction

Example architecture

SQL WebsiteN L B

Website

Website

Page 60: App fabric introduction

Example architecture

SQL WebsiteN L B

Website

Website“Timeout”

Page 61: App fabric introduction

An important change was made…

Page 62: App fabric introduction

Example architecture

SQL WebsiteN L B

Website

Website

Prepublished Databases using SQL Express

Sync Framework

Isolated servers

One way!

Page 63: App fabric introduction

How to submit state changes to backend?

Page 64: App fabric introduction

Example architecture

SQL WebsiteN L B

Website

Website

Sync Framework

BackendWCF

Service

MSMQAppFabric Hosting

Cache

Page 65: App fabric introduction

Example architecture

SQL WebsiteN L B

Website

Website

Sync Framework

Backend

Service

MSMQAppFabric Hosting

Cache

REST Based Service Layer

SB AC

The near future?

Page 66: App fabric introduction

Summary

• Different AppFabric components• Difference Azure & Windows AppFabric• New architectural choices• Do you see benefits or opportunities?

Page 67: App fabric introduction

questionsResources:• .NET Magazine maart 2010 & SDN Magazine• http://www.microsoft.com/windowsazure/• http://bit.ly/1P6f5D• http://bloggingabout.net/blogs/dennis/