SlideShare a Scribd company logo
Como garantir a escalabilidade da sua camada de dados com o Windows Server AppFabricWIN304NunoGodinhoPartner & CTO @ ITech4Allnuno.godinho@itech4all.com@NunoGodinho
Session abstractSession title
Speaker Bio and PhotoSpeaker Name
Nuno Filipe GodinhoPartner & CTO @ ITech4allMail: 	Nuno.Godinho@itech4all.comNuno.Godinho@sapo.ptBlogs:	http://pontonetpt.com/blogs/nunogodinhohttp://xamlpt.com/blogs/nunogodinhohttp://weblogs.asp.net/nunogodinhohttp://msmvps.org/blogs/nunogodinhoTwitter: @NunoGodinhoAbout Me
The Problem!Caching with the Windows Server AppFabricOverview and Programming ModelCaching FuturesSummaryQ&AAgenda
The Problem
Online Pharmacy
Typical Web Architecture
Typical ArchitectureUsersLoad BalancerSticky RoutingApplication/ Web Tier Application Application ApplicationASP.Net App Session Cart Hosted in memoryCatalog sits in DatabaseData TierDatabase
And then… Flu Hits!
You become a popular Pharmacy!Web Site’s too slow!!UsersWhere did my shopping cart go?Web Tier(ASP.Net)… Application Application ApplicationServers are crashingDatabase is hot!!Data TierDatabase
Possible Solution
Data Near ProcessingCacheCacheBrowserSmart ClientCacheWeb ServiceASP.NETCacheCacheDatabase
Cache is scoped to machine  / processMachines dieProcesses recycleCache memory is limitedGood but…
You could have as much cache as you wanted?You could share a giant cache across servers, services and even clients?What if this was something you could simply add to the platform for 1free?1Some features may require certain editions of Windows Server What if?
Caching with the Windows Server AppFabric
What Is It?
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 cacheWhat is AppFabric Caching?Caching clients can be across machines or processesClients Access the Cache as if it was a large single cacheUnified Cache ViewCache Layer distributes data across the various cache nodes
Where does it fit?UsersCaching Access LayerCaching Access LayerCaching Access Layer…Web Tier(ASP.Net) Application Application ApplicationCaching ServiceCaching ServiceCaching ServiceCache TierData TierDatabaseCloud
AppFabric Cache
Why AppFabric Caching
1. Share Data Across ApplicationsNo more sticky routing2. Performance3. Scale out by adding more boxes4. High Availability  Protect from Web & Cache Server FailureWhy use AppFabric Caching?
5. Proven Technology - Associated Press Custom News live on CTP3Why use AppFabric Caching?AppFabric caching capabilities caches metadata and news for widgets
Serves 16 million hits per day
Increased the amount of cached data 6 times.5. Proven Technology Contd..Dell.com uses AppFabric caching!Channel Partner Portal uses AppFabric cachingProvides 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 productionWhy AppFabric Caching?
6. Do all this at low cost!Why AppFabric Caching? – Best yetUse 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.AppFabricMONITORINGWORKFLOW HOSTINGCACHINGACCESS CONTROLSERVICE HOSTINGSERVICE BUSMANAGEMENTMULTI-TENANT SCALE OUTHIGH AVAILABILITY
What Stage Is It In?
When Can I Get Windows Server AppFabric ?Azure CTPPost RTMRTM2010 Wave 1* CY10CTP2PDC ‘08CTP1June ‘08CTP3Mar ‘09BetaPDC
Nov ‘09(Formerly Called “Velocity”)
Installation
Overview and Programming AppFabric Caching
Deployment and Access API
DeploymentUsersUpdate Web.configCopy Client DLLs Application Application Application…Caching Access LayerCaching Access LayerCaching Access Layer<hosts>      <host name="BL1CDB8083714“cachePort="22233" cacheHostName="DistributedCacheService"/>     …..   </hosts> <localCacheisEnabled=“true"  ../><security … />.NET 3.5 SP1 OR .NET 4Caching ServiceCaching  ServiceCaching  Service.NET 4Configure AppFabricInstall AppFabricConfiguration Store
AppFabric Caching CodePlex Toolhttp://mdcadmintool.codeplex.com/
Domain Based Security OptionDomain Account / Local Account based AuthenticationOnly authorized servers can join the clusterOnly authorized clients can connect to the clusterTransport Level SecurityTurn on/off Signing or EncryptionCan turn off Cache SecurityUse Firewalls, IPSec,  VLANs to protect cacheSecurity (new since Beta) grant-cacheallowedclientaccount  RedDomain\Machine1$  grant-cacheallowedclientaccount  RedDomain\John
Centralized administration through powershellPerfmon to monitor the cache (new in Beta)Logging Default ETW, support for file logs Administration & Monitoring
// Create instance of cachefactory (reads appconfig)DataCacheFactoryfac = new DataCacheFactory();// Get a named cache from the factoryDataCache catalog = fac.GetCache("catalogcache");AppFabric Caching API// Simple Get/Putcatalog.Put("toy-101", new Toy("Puzzle", .,.));// From the same or a different clientToy toyObj = (Toy)catalog.Get("toy-101");// Region based Get/Putcatalog.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 HierarchyAppFabric Caching ServiceAppFabric Caching ServiceAppFabric Caching ServiceAppFabric Caching ServiceNamed Cache :                    Product CatalogNamed Cache :                    Electronics InventoryRegions Key   Payload     Tags     Region A121  xxxx    “Toy” “Child”123 yyyy   “Toy” “Chair”.. Machine -> Cache Host -> Named Caches -> Regions -> Cache Items -> ObjectsHostPhysical processes hosting AppFabric Caching instance.Named CachesCan span across machinesDefined in the configuration fileCache ItemKey, Payload (Object ), Tags,  TTL, Timestamps, VersionRegionsPhysically co-located Container of Cache ItemsMay be implicit or explicitly created
Add Tags to ItemsTag Search on Default Regions (New in Beta)Access APIs – Tagging ItemsTag 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 clientList<KeyValuePair<string, object>> toys = catalog.GetAnyMatchingTag("toyRegion", hotItem);
Usage Pattern – Cache Aside  (Explicit Caching)//  Read from CacheToy toyObj = (Toy)catalog.Get("toy-101"); ApplicationCaching Access Layer// If Not present in the cacheif (toyObj == null){   // Read from backend..   toyObj = ReadFromDatabase();   // Populate Cachecatalog.Put("toy-101", toyObj);    return toyObj;}Caching ServiceDatabase
How does it Scale?
Data Distribution - Partitioned CacheUsers…GHIDEFABCWeb TierASP.Net AppASP.Net AppASP.Net AppCaching ClientCaching ClientCaching ClientEGBDHAICFCache  ServiceCache  ServiceCache TierCache  ServiceScale on Data Size -More machines => More memory to cacheScale on Cache Throughput  -More machines => keys distributed across more machines => better throughput
Scale Test OutputLoad1 Cache ServerAs load increases, throughput fails to scale latency increasesCaching TierThroughputLatency
Add Second Cache ServerLoadLoad MaxThroughput increasesLatency decreasesCaching TierThroughputLatency
Add Third Cache ServerLoadCaching TierThroughputLatency
GridDynamics Blog Engine TestsMore info at  http://blogs.msdn.com/velocity/ orhttp://www.griddynamics.com/velocity
Features
Classify your data Reference or Activity or Resource DataExamine RequirementsPerformance - Throughput & Latency	Consistency – Tolerable stalenessEviction  - Is the data evictable?Security - Is there any secure data?Availability – Survive node or cluster failures?Use the right features!
Types of DataGrocery Shop Web Tier     Shopping CartPharmacy InventoryDistributed CachePharmacy Catalog
Catalog data doesn’t change oftenUnnecessary network cost to access from different machinesSolution – Local CacheApplicationApplicationReference Data – PerformanceGet(K2)Get(K2)Put(K2, v3)AppFabric Caching ClientAppFabric Caching ClientLocal CacheRouting TableRouting TableK2, V2K2, V2Cache2Cache3Cache1Primary for K1,V1Primary for K3,V3Primary for K2,V2K1, V1K2, V3K3, V3
Enumerate all items in RegionBulk Fetch from region (New in Beta)200-300k ops per secondReference Data – Bulk GetCatalog.BulkGet(      new List<string>(){“toy-101”, “toy-102”} ,      “toyRegion”);
ApplicationPUTApplicationGet(K2)AppFabric Caching ClientAppFabric Caching ClientRouting TableRouting TableCache1Cache2Cache3Activity Data - AvailabilityPrimary forPrimary forPrimary for Replication Agent(K2, V2)K3, V3K2, V2K1, V1K2, V2K2, V2Secondary forSecondary for Secondary forK3, V3K1, V1
GetCacheItem returns a version objectEvery update to an object internally increments it's versionSupply the version obtained along with the Put/RemovePut/Remove will succeed only if the passed in version matches the version in the cache Resource Data - Optimistic LockingTwo clients access the same item Both update the itemSecond Client gets in first; put succeeds because item version matches; atomically increments the versionFirst client tries put;Fails because the versions don’t match
Resource Data - Pessimistic LockingClient1: GetAndLock ("k1")Client3: Get ("k1")Client2: GetAndLock ("k1")GetAndLock gets lock handleRegular Get succeeds Other GetAndLock on same item failsNew in Beta – Take locks on non-existent keysAllows you to co-ordinate creating new object amongst multiple clientsK1
Cache Event notificationsRegister on any client to notify changesBatched Notifications – (New in Beta)Resource/Activity Data – Tracking ChangesDataCache.RegisterCacheLevelCallback(int filter, DataCacheChangeCallback delegate); DataCache.RegisterRegionLevelCallback(      String region, int filter, DataCacheChangeCallback delegate); DataCache.RegisterKeyLevelCallback(      String region, String key, int filter, DataCacheChangeCallback delegate);
Register Notification for Key “K3"Call DelegateStore Last LSN Map Keys to Partition (say P2)ApplicationAppFabric Caching ClientPartition: P2Last LSN: 19Routing TablePoll Required NodesNodes Return List of ChangesLSN OrderCache2Cache3Cache1K2, V2Primary forPrimary forPrimary forChange Log (Partition P2)Del  K32Del  K43Change LogPartition P1Add K2Del  K32Change Log33 Add K134 Del  K22K1, V1K3, V3Scalable Notifications
Programming Model
AppFabric Caching Futures
AppFabric Caching and Azure Platform
You are a popular Online Pharmacy!!Lots of Users!Irregular & Elastic DemandsSolution - Move to the Services World!Application on-premise with data on SQL AzureApplication on Windows Azure with data on SQL AzureApplication on Windows Azure with on-premise database connected by AppFabric Service BusApplication Growth
App on-premise; Data on SQLAzure…ASP.Net Web Tier Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerApplication & AppFabric Caching deployed On-premiseCaching  ServiceCaching  ServiceCaching  ServiceCaching Worker RoleData on SQL Azure
App on Windows Azure; Data on SQL AzureWeb Role… Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerApplication & AppFabric Caching on Windows AzureCaching  ServiceCaching  ServiceCaching  ServiceCaching Worker RoleAppFabric Caching Worker RoleData on SQL Azure
App on Windows Azure; Data on-premiseWeb Role… Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Service BusApplication & AppFabric Caching on Windows AzureCaching  ServiceCaching  ServiceCaching  ServiceCaching Worker RoleAppFabric Caching Worker RoleData on-premises
ASP.NET and Persistence
ASP.Net extends cache surface .Net 4.0Integrate with the Application CacheSystem.Runtime.Caching namespaceAppFabric Caching will be a provider for this namespaceGranular Session UpdatesIPartialSessionState lists keys changedExtensible Output Cache ProviderOutput Caching not limited to single nodeIntegration with ASP.Net
Callback for read-through, write-behind Specified at Named Cache LevelRead-ThroughCalled when item not present in cacheCallback returns the object/serialized bytesWrite-BehindWrites to cache are queued Callback called asynchronously in batchesRe-tries upon failureBulk Access APIsFuture – Cache Through
HPC IntegrationFinal Results StoreAppFabric CachingMarket DataCentral Market Data Store(~1 TB Tick Data)FinalResultsAppFabric CachingIntermediateStoreMarket DataScratchJob InputRollupOperationSplitMethodScratchKeysCalculationOperationGridDynamics testing    on CTP1   50 times improvement   in some cases

More Related Content

PDF
ODTUG Webinar AWR Warehouse
PDF
Api manager preconference
PPT
"Running CF in a Shared Hosting Environment"
PPTX
Power of the AWR Warehouse
PPTX
TechDays 2010 Portugal - The Microsoft Silverlight Analytics Framework 16x9
PPT
Vistage International New Member Start
PPTX
Wif and sl4 (en)
PPT
Baptism 26 1 07
ODTUG Webinar AWR Warehouse
Api manager preconference
"Running CF in a Shared Hosting Environment"
Power of the AWR Warehouse
TechDays 2010 Portugal - The Microsoft Silverlight Analytics Framework 16x9
Vistage International New Member Start
Wif and sl4 (en)
Baptism 26 1 07

Viewers also liked (12)

PPTX
Deepening relationship with god PDYD presentation
PPT
Tips & Tricks On Architecting Windows Azure For Costs
PPTX
Extensibility with sl4 and mef (en)
PPTX
TechDays 2010 Portugal - Introduction to Silverlight 4.0 16x9
PPTX
TechDays 2010 Portugal - WCF RIA Services 16x9
PPTX
TechDays 2010 Portugal - Entity Framework 4.0 and Beyond
PPTX
TechDays 2010 Portugal - Event Driven Architectures - 16x9
PPT
Leadership Of Christ
PPT
Architecture Best Practices on Windows Azure
PPTX
Windows Azure Security & Compliance
PPT
Youth Retreat Youth Gift To Community
PPT
Youth Leadership Responsibility To Church & Youth
Deepening relationship with god PDYD presentation
Tips & Tricks On Architecting Windows Azure For Costs
Extensibility with sl4 and mef (en)
TechDays 2010 Portugal - Introduction to Silverlight 4.0 16x9
TechDays 2010 Portugal - WCF RIA Services 16x9
TechDays 2010 Portugal - Entity Framework 4.0 and Beyond
TechDays 2010 Portugal - Event Driven Architectures - 16x9
Leadership Of Christ
Architecture Best Practices on Windows Azure
Windows Azure Security & Compliance
Youth Retreat Youth Gift To Community
Youth Leadership Responsibility To Church & Youth
Ad

Similar to TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9 (20)

PPTX
Scale Your Data Tier With Windows Server App Fabric
PPTX
Microsoft Windows Server AppFabric
PPTX
Scale Your Data Tier with Windows Server AppFabric
PPTX
Windows Server AppFabric Caching - What it is & when you should use it?
PDF
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
PPTX
Scalable Resilient Web Services In .Net
PDF
The Need For Speed - NxtGen Cambridge
PDF
Introducing windows server_app_fabric
PPTX
Windows Server AppFabric Cache
PDF
The Need for Speed - EpiCenter 2010
PDF
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
PDF
Velocity - Edge UG
PDF
The Need For Speed - NEBytes
PDF
Azure appfabric caching intro and tips
PPTX
App fabric introduction
PDF
Distributed Caching Using Windows Azure AppFabric
PPTX
App fabric hybrid computing
PPTX
Exploring App fabric
PPT
Aspnet Caching
PPTX
Distributed Cache with dot microservices
Scale Your Data Tier With Windows Server App Fabric
Microsoft Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabric
Windows Server AppFabric Caching - What it is & when you should use it?
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
Scalable Resilient Web Services In .Net
The Need For Speed - NxtGen Cambridge
Introducing windows server_app_fabric
Windows Server AppFabric Cache
The Need for Speed - EpiCenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Velocity - Edge UG
The Need For Speed - NEBytes
Azure appfabric caching intro and tips
App fabric introduction
Distributed Caching Using Windows Azure AppFabric
App fabric hybrid computing
Exploring App fabric
Aspnet Caching
Distributed Cache with dot microservices
Ad

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PPTX
Cloud computing and distributed systems.
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Spectral efficient network and resource selection model in 5G networks
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MIND Revenue Release Quarter 2 2025 Press Release
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Cloud computing and distributed systems.
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectral efficient network and resource selection model in 5G networks

TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9

  • 1. Como garantir a escalabilidade da sua camada de dados com o Windows Server AppFabricWIN304NunoGodinhoPartner & CTO @ ITech4Allnuno.godinho@itech4all.com@NunoGodinho
  • 3. Speaker Bio and PhotoSpeaker Name
  • 4. Nuno Filipe GodinhoPartner & CTO @ ITech4allMail: Nuno.Godinho@itech4all.comNuno.Godinho@sapo.ptBlogs: http://pontonetpt.com/blogs/nunogodinhohttp://xamlpt.com/blogs/nunogodinhohttp://weblogs.asp.net/nunogodinhohttp://msmvps.org/blogs/nunogodinhoTwitter: @NunoGodinhoAbout Me
  • 5. The Problem!Caching with the Windows Server AppFabricOverview and Programming ModelCaching FuturesSummaryQ&AAgenda
  • 9. Typical ArchitectureUsersLoad BalancerSticky RoutingApplication/ Web Tier Application Application ApplicationASP.Net App Session Cart Hosted in memoryCatalog sits in DatabaseData TierDatabase
  • 11. You become a popular Pharmacy!Web Site’s too slow!!UsersWhere did my shopping cart go?Web Tier(ASP.Net)… Application Application ApplicationServers are crashingDatabase is hot!!Data TierDatabase
  • 13. Data Near ProcessingCacheCacheBrowserSmart ClientCacheWeb ServiceASP.NETCacheCacheDatabase
  • 14. Cache is scoped to machine / processMachines dieProcesses recycleCache memory is limitedGood but…
  • 15. You could have as much cache as you wanted?You could share a giant cache across servers, services and even clients?What if this was something you could simply add to the platform for 1free?1Some features may require certain editions of Windows Server What if?
  • 16. Caching with the Windows Server AppFabric
  • 18. 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 cacheWhat is AppFabric Caching?Caching clients can be across machines or processesClients Access the Cache as if it was a large single cacheUnified Cache ViewCache Layer distributes data across the various cache nodes
  • 19. Where does it fit?UsersCaching Access LayerCaching Access LayerCaching Access Layer…Web Tier(ASP.Net) Application Application ApplicationCaching ServiceCaching ServiceCaching ServiceCache TierData TierDatabaseCloud
  • 22. 1. Share Data Across ApplicationsNo more sticky routing2. Performance3. Scale out by adding more boxes4. High Availability Protect from Web & Cache Server FailureWhy use AppFabric Caching?
  • 23. 5. Proven Technology - Associated Press Custom News live on CTP3Why use AppFabric Caching?AppFabric caching capabilities caches metadata and news for widgets
  • 24. Serves 16 million hits per day
  • 25. Increased the amount of cached data 6 times.5. Proven Technology Contd..Dell.com uses AppFabric caching!Channel Partner Portal uses AppFabric cachingProvides 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 productionWhy AppFabric Caching?
  • 26. 6. Do all this at low cost!Why AppFabric Caching? – Best yetUse inexpensive commodity hardware
  • 27. Ships as part of Windows Server AppFabric 2010 Wave 1 * Different Features of the cache might require higher level SKUs of Windows Server.AppFabricMONITORINGWORKFLOW HOSTINGCACHINGACCESS CONTROLSERVICE HOSTINGSERVICE BUSMANAGEMENTMULTI-TENANT SCALE OUTHIGH AVAILABILITY
  • 28. What Stage Is It In?
  • 29. When Can I Get Windows Server AppFabric ?Azure CTPPost RTMRTM2010 Wave 1* CY10CTP2PDC ‘08CTP1June ‘08CTP3Mar ‘09BetaPDC
  • 30. Nov ‘09(Formerly Called “Velocity”)
  • 32. Overview and Programming AppFabric Caching
  • 34. DeploymentUsersUpdate Web.configCopy Client DLLs Application Application Application…Caching Access LayerCaching Access LayerCaching Access Layer<hosts> <host name="BL1CDB8083714“cachePort="22233" cacheHostName="DistributedCacheService"/> ….. </hosts> <localCacheisEnabled=“true" ../><security … />.NET 3.5 SP1 OR .NET 4Caching ServiceCaching ServiceCaching Service.NET 4Configure AppFabricInstall AppFabricConfiguration Store
  • 35. AppFabric Caching CodePlex Toolhttp://mdcadmintool.codeplex.com/
  • 36. Domain Based Security OptionDomain Account / Local Account based AuthenticationOnly authorized servers can join the clusterOnly authorized clients can connect to the clusterTransport Level SecurityTurn on/off Signing or EncryptionCan turn off Cache SecurityUse Firewalls, IPSec, VLANs to protect cacheSecurity (new since Beta) grant-cacheallowedclientaccount  RedDomain\Machine1$ grant-cacheallowedclientaccount  RedDomain\John
  • 37. Centralized administration through powershellPerfmon to monitor the cache (new in Beta)Logging Default ETW, support for file logs Administration & Monitoring
  • 38. // Create instance of cachefactory (reads appconfig)DataCacheFactoryfac = new DataCacheFactory();// Get a named cache from the factoryDataCache catalog = fac.GetCache("catalogcache");AppFabric Caching API// Simple Get/Putcatalog.Put("toy-101", new Toy("Puzzle", .,.));// From the same or a different clientToy toyObj = (Toy)catalog.Get("toy-101");// Region based Get/Putcatalog.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");
  • 39. AppFabric Caching Logical HierarchyAppFabric Caching ServiceAppFabric Caching ServiceAppFabric Caching ServiceAppFabric Caching ServiceNamed Cache : Product CatalogNamed Cache : Electronics InventoryRegions Key Payload Tags Region A121 xxxx “Toy” “Child”123 yyyy “Toy” “Chair”.. Machine -> Cache Host -> Named Caches -> Regions -> Cache Items -> ObjectsHostPhysical processes hosting AppFabric Caching instance.Named CachesCan span across machinesDefined in the configuration fileCache ItemKey, Payload (Object ), Tags, TTL, Timestamps, VersionRegionsPhysically co-located Container of Cache ItemsMay be implicit or explicitly created
  • 40. Add Tags to ItemsTag Search on Default Regions (New in Beta)Access APIs – Tagging ItemsTag 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 clientList<KeyValuePair<string, object>> toys = catalog.GetAnyMatchingTag("toyRegion", hotItem);
  • 41. Usage Pattern – Cache Aside (Explicit Caching)// Read from CacheToy toyObj = (Toy)catalog.Get("toy-101"); ApplicationCaching Access Layer// If Not present in the cacheif (toyObj == null){ // Read from backend.. toyObj = ReadFromDatabase(); // Populate Cachecatalog.Put("toy-101", toyObj); return toyObj;}Caching ServiceDatabase
  • 42. How does it Scale?
  • 43. Data Distribution - Partitioned CacheUsers…GHIDEFABCWeb TierASP.Net AppASP.Net AppASP.Net AppCaching ClientCaching ClientCaching ClientEGBDHAICFCache ServiceCache ServiceCache TierCache ServiceScale on Data Size -More machines => More memory to cacheScale on Cache Throughput -More machines => keys distributed across more machines => better throughput
  • 44. Scale Test OutputLoad1 Cache ServerAs load increases, throughput fails to scale latency increasesCaching TierThroughputLatency
  • 45. Add Second Cache ServerLoadLoad MaxThroughput increasesLatency decreasesCaching TierThroughputLatency
  • 46. Add Third Cache ServerLoadCaching TierThroughputLatency
  • 47. GridDynamics Blog Engine TestsMore info at http://blogs.msdn.com/velocity/ orhttp://www.griddynamics.com/velocity
  • 49. Classify your data Reference or Activity or Resource DataExamine RequirementsPerformance - Throughput & Latency Consistency – Tolerable stalenessEviction - Is the data evictable?Security - Is there any secure data?Availability – Survive node or cluster failures?Use the right features!
  • 50. Types of DataGrocery Shop Web Tier Shopping CartPharmacy InventoryDistributed CachePharmacy Catalog
  • 51. Catalog data doesn’t change oftenUnnecessary network cost to access from different machinesSolution – Local CacheApplicationApplicationReference Data – PerformanceGet(K2)Get(K2)Put(K2, v3)AppFabric Caching ClientAppFabric Caching ClientLocal CacheRouting TableRouting TableK2, V2K2, V2Cache2Cache3Cache1Primary for K1,V1Primary for K3,V3Primary for K2,V2K1, V1K2, V3K3, V3
  • 52. Enumerate all items in RegionBulk Fetch from region (New in Beta)200-300k ops per secondReference Data – Bulk GetCatalog.BulkGet( new List<string>(){“toy-101”, “toy-102”} , “toyRegion”);
  • 53. ApplicationPUTApplicationGet(K2)AppFabric Caching ClientAppFabric Caching ClientRouting TableRouting TableCache1Cache2Cache3Activity Data - AvailabilityPrimary forPrimary forPrimary for Replication Agent(K2, V2)K3, V3K2, V2K1, V1K2, V2K2, V2Secondary forSecondary for Secondary forK3, V3K1, V1
  • 54. GetCacheItem returns a version objectEvery update to an object internally increments it's versionSupply the version obtained along with the Put/RemovePut/Remove will succeed only if the passed in version matches the version in the cache Resource Data - Optimistic LockingTwo clients access the same item Both update the itemSecond Client gets in first; put succeeds because item version matches; atomically increments the versionFirst client tries put;Fails because the versions don’t match
  • 55. Resource Data - Pessimistic LockingClient1: GetAndLock ("k1")Client3: Get ("k1")Client2: GetAndLock ("k1")GetAndLock gets lock handleRegular Get succeeds Other GetAndLock on same item failsNew in Beta – Take locks on non-existent keysAllows you to co-ordinate creating new object amongst multiple clientsK1
  • 56. Cache Event notificationsRegister on any client to notify changesBatched Notifications – (New in Beta)Resource/Activity Data – Tracking ChangesDataCache.RegisterCacheLevelCallback(int filter, DataCacheChangeCallback delegate); DataCache.RegisterRegionLevelCallback( String region, int filter, DataCacheChangeCallback delegate); DataCache.RegisterKeyLevelCallback( String region, String key, int filter, DataCacheChangeCallback delegate);
  • 57. Register Notification for Key “K3"Call DelegateStore Last LSN Map Keys to Partition (say P2)ApplicationAppFabric Caching ClientPartition: P2Last LSN: 19Routing TablePoll Required NodesNodes Return List of ChangesLSN OrderCache2Cache3Cache1K2, V2Primary forPrimary forPrimary forChange Log (Partition P2)Del K32Del K43Change LogPartition P1Add K2Del K32Change Log33 Add K134 Del K22K1, V1K3, V3Scalable Notifications
  • 60. AppFabric Caching and Azure Platform
  • 61. You are a popular Online Pharmacy!!Lots of Users!Irregular & Elastic DemandsSolution - Move to the Services World!Application on-premise with data on SQL AzureApplication on Windows Azure with data on SQL AzureApplication on Windows Azure with on-premise database connected by AppFabric Service BusApplication Growth
  • 62. App on-premise; Data on SQLAzure…ASP.Net Web Tier Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerApplication & AppFabric Caching deployed On-premiseCaching ServiceCaching ServiceCaching ServiceCaching Worker RoleData on SQL Azure
  • 63. App on Windows Azure; Data on SQL AzureWeb Role… Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerApplication & AppFabric Caching on Windows AzureCaching ServiceCaching ServiceCaching ServiceCaching Worker RoleAppFabric Caching Worker RoleData on SQL Azure
  • 64. App on Windows Azure; Data on-premiseWeb Role… Application Application ApplicationAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Caching Access LayerAppFabric Service BusApplication & AppFabric Caching on Windows AzureCaching ServiceCaching ServiceCaching ServiceCaching Worker RoleAppFabric Caching Worker RoleData on-premises
  • 66. ASP.Net extends cache surface .Net 4.0Integrate with the Application CacheSystem.Runtime.Caching namespaceAppFabric Caching will be a provider for this namespaceGranular Session UpdatesIPartialSessionState lists keys changedExtensible Output Cache ProviderOutput Caching not limited to single nodeIntegration with ASP.Net
  • 67. Callback for read-through, write-behind Specified at Named Cache LevelRead-ThroughCalled when item not present in cacheCallback returns the object/serialized bytesWrite-BehindWrites to cache are queued Callback called asynchronously in batchesRe-tries upon failureBulk Access APIsFuture – Cache Through
  • 68. HPC IntegrationFinal Results StoreAppFabric CachingMarket DataCentral Market Data Store(~1 TB Tick Data)FinalResultsAppFabric CachingIntermediateStoreMarket DataScratchJob InputRollupOperationSplitMethodScratchKeysCalculationOperationGridDynamics testing on CTP1 50 times improvement in some cases
  • 70. AppFabric Caching Vision – Cache for all your data

Editor's Notes

  • #29: MSCUIBusiness Application Template
  • #33: MSCUIBusiness Application Template
  • #56: MSCUIBusiness Application Template