Post on 14-Dec-2014
description
transcript
Microsoft AppFabric
Dennis van der SteltTellus
• Tellus– Lead generation– 10k websites– Looking for developers .NET Geeks
• Dennis van der Stelt– http://bloggingabout.net/blogs/dennis/ – http://twitter.com/dvdstelt– dennis@bloggingabout.net
Introducing
Session objectives
Azure AppFabric
Architectural choices
Windows AppFabric
AppFabric
• Services to build and manage composite applications
• Formerly known as– BizTalk Services– .NET Services– Velocity– Dublin
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
SERVICE & WORKFLOWMANAGEMENT
Windows Server AppFabric
Brought my own whiteboard
ClientWCF
Service Database
Hosting services
Host
What are the current hosting capabilities of services?
ClientWCF
Service Database
Hosting services
Host
#1 – Your own application (Self hosted)
No quality of service
MyApp.exe
Easiest to deploy
ClientWCF
Service Database
Hosting services
Host
#2 – Windows Service
MyService.exe
Run in background, some monitoringHardly any quality of service
ClientWCF
Service Database
Hosting services
IIS
#3 – Internet Information Services
MyService.svc
Excellent quality of serviceSupports only HTTP protocol
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
Enter Dublin…
ClientWCF
Service Database
Hosting services
AppFabric
#4 – Service & Workflow Management
MyService.svc
Quality of Service from IIS/WASHosting scalable workflow & WCF Services
Workflow
Windows Server
.NET Framework
Windows Server AppFabric
Services
Management Tools
IIS/WAS
Workflows
Runtime DatabasesPersistence Monitoring
HostingPersistence CachingMonitoring
IIS Manager Modules
PowerShell
ScalableShare workflow state across machines
AppFabric Hosting
Windows Service + AppFabric
Windows Service + AppFabric
Windows Service + AppFabric
PersistenceDatabase
Management Service
Management Service
Management Servicex
ScalableRetry mechanism for race conditions
AppFabric Hosting
Windows Service + AppFabric
Windows Service + AppFabric
Management Service
Management Service
Client3F2504E0-4F89-11D3-1337-
…
Persistence Database
x
CACHINGWindows Server AppFabric
Let’s look at a problemyou might experience yourself…
AppFabric Caching
WebServer
WebServer
WebServer
Load Balancer
Database
AppFabric Caching
WebServer
WebServer
WebServer
Load Balancer
Database
x
AppFabric Caching
WebServer
WebServer
WebServer
Load Balancer
Database
Solution is sticky sessions…
We’ll have uneven load balancing,we might loose sessions,
etc…
AppFabric Caching
WebServer
WebServer
WebServer
Load Balancer
Database
Another solution is using DBMS to store sessions
Doesn’t scale well,we’ll have a performance bottleneck.
And clustering is costly andfault sensitive!
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
AppFabric Caching
WebServer
WebServer
WebServer
Load Balancer
Database
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%
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
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"];
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);}
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);
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");
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);}
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
Azure AppFabric
• Webbased services• Yes, in the cloud!• Allow you to easily connect applications
SERVICE BUSAzure AppFabric
Azure Service Bus
Azure Service Bus
Let’s open a port and do some forwarding
Azure Service Bus
Oh, what about NAT, Proxies, etc?
Azure Service Bus
Service Bus
Azure Service Bus
Service Bus
App
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)
Azure AppFabric LABShttp://portal.appfabriclabs.com/
ACCESS CONTROLAzure AppFabric
Azure Access Control
Service Bus
Federated Identity
Azure Access Control
Service Bus
Access Control
ID
Azure Access Control
Service Bus
Access Control
App ID
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
Access Control
• The future• No WS* available yet… or no longer?• CardSpace• Support for other web identity providers
– Windows Live– Google– Yahoo– OpenId
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
Example (real world) architecture
Example architecture
SQL Website
Example architecture
SQL Website“Server Busy”
Example architecture
SQL WebsiteN L B
Website
Website
Example architecture
SQL WebsiteN L B
Website
Website“Timeout”
An important change was made…
Example architecture
SQL WebsiteN L B
Website
Website
Prepublished Databases using SQL Express
Sync Framework
Isolated servers
One way!
How to submit state changes to backend?
Example architecture
SQL WebsiteN L B
Website
Website
Sync Framework
BackendWCF
Service
MSMQAppFabric Hosting
Cache
Example architecture
SQL WebsiteN L B
Website
Website
Sync Framework
Backend
Service
MSMQAppFabric Hosting
Cache
REST Based Service Layer
SB AC
The near future?
Summary
• Different AppFabric components• Difference Azure & Windows AppFabric• New architectural choices• Do you see benefits or opportunities?
questionsResources:• .NET Magazine maart 2010 & SDN Magazine• http://www.microsoft.com/windowsazure/• http://bit.ly/1P6f5D• http://bloggingabout.net/blogs/dennis/