SlideShare a Scribd company logo
Windows Server AppFabric Caching - What it is & when you should use it?
Robert MacLeanTechnology SpecialistBB&DWindows Server AppFabric Caching: What it is & When you should use it?
Who am I?Robert MacLeanMicrosoft ALM MVPMicrosoft ALM RangerProud Community Lead Information WorkerS.A. Architectwww.sadev.co.za@rmaclean
OvertureLevel 300State of playBriefly what is AppFabric?What do we get from AppFabric Caching and how to use it!
Advert TimeAppFabric:Wed, 11:15pm - WCF Made Easy with .NET 4 and Windows Server AppFabricOther:Wed, 8:30pm - Tales From the field – Best practices and guidance on implementing TFS2010
State of play.NET prior to 4ASP.NET CachingEnterprise Library Caching.NET 4 brings us.NET 4 CachingAll are local in-memory caches!
.NET 4 CachingDemo
What is the issue with these?Limited to memory of current machineLimited to current processImagine if I need 50Gb of cache?What about load balancing?
A rose by any other name…Windows Server AppFabric contains two key componentsHostingEndPoint, Windows App Server Extensions, DublinCachingVelocityNot to be confused with Azure AppFabric
N.B. AppFabricRequires .NET 4 on ServerNot all applications need .NET 4, depends on features usedStandalone download or Web Platform InstallerHigh Availability is only in Windows Server 2008 Enterprise & Data Centre
What is AppFabric Cache?An in-memory distributed cache which you can call from any .NET applicationOptimised for the cache-aside patternProgramming against the cache is explicitChanging the cache doesn’t update the original data store
AppFabric Cache Single ViewCache ServerSingle view from codeServicesCache ServerData 1Data 2Data 3Data 4Cache ServerCache Server
AppFabric Caching InfoCommon Configuration StoreXMLDatabaseRuns as Windows ServiceCommunication Between NodesWCF net.tcpSelf Adjusting
AppFabric Server TypesDedicated Cache ServerAll it does is AppFabric caching – good for lots of memory and great performationHybrid Cache ServerRuns AppFabric caching & other tools. SQL + AppFabricWeb + AppFabricLocal Cache ServerRuns AppFabric per application locallyUsed in conjunction with hybrid and/or dedicated
What can I cache?Anything that can be serialisedXMLPOCOBinary Data
Data Cache PlanningReference DataCities, provinces, product info, etc…Activity DataSession, per user etc..Resource DataData with contention We will look at this more later…NB: Plan, plan and plan some more
ManagementAll Configuration and Administration is done via PowerShellFrom the MVP’s: http://mdcadmintool.codeplex.com/
AppFabric from IT Pro to DeveloperDemo
Cache Structure ReviewServerServerServerNamed Cache: DefaultNamed Cache: ProductsNamed Cache: UsersRegion: MaleRegion: FemaleItems & Tags
Expiration of cache itemsPut & AddTimeoutNotificationPolling Default: 300 secsExpiration timeout defaults can be controlled on a cache level
Eviction@ Low watermarkExpired items removed@ High watermarkItems, expired or not, can be removed or allocated to another serverItems picked by using LRU Can disable if needed
ORM’sSome ORM’s implement second level cachingIt is possible to change the second level to AppFabricExamples: NHibernate & Entity Framework
A Problem with Caching AppFabric CacheName : RobertBalance: 1500WriteDBName : RobertBalance: 15ATMATMORMUIORMUIName : RobertBalance: 15
Solution.GetAndLock.PutAndUnlock.UnlockSupports locking timeoutLocked items can survive expirationUnlock can prolong expiration
Data Cache PlanningReference DataCities, provinces, product info, etc…Activity DataSession, per user etc..Resource DataData with contention NB: Plan, plan and plan some moreGreat with defaultsRegion per userLocking per item
Cluster ConfigurationFirst node initialises clusterOther nodes joinDuring install you must configure projected sizeSmall: 1 – 5 nodes Medium: 6 – 15 nodesLarge: > 15 nodesPerformance based on this setting – adding/removing nodes does not effect this
SecurityDomain:Authentication in AD, Authorisation in AppFabricOnly authorised servers join clustersOnly authorised clients connect to clustersWorkgroupAuthentication in network share, Authorisation in AppFabricTransport Level SecuritySigning and Encryption
Typical Web ArchitectureUsersWeb ServersLoad BalancerStateStateStateDB
ASP.NETOut of the box caching InProc (Default)StateServerSQLServerAll can be enabled by via config changeNow AppFabric support also just a config change
ASP.NET AppFabricConfig<configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient><fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/>    </collection>  </section></fabric><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web>
ASP.NET AppFabricConfig<configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient><fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/>    </collection>  </section></fabric><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web><configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections>
ASP.NET AppFabricConfig<configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient><fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/>    </collection>  </section></fabric><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient>
ASP.NET AppFabricConfig<fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>   …    </collection>  </section></fabric><configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient><fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/>    </collection>  </section></fabric><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web>
ASP.NET AppFabricConfig<configSections>  <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/>  <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing">  <localCacheisEnabled="false"/>  <hosts>    <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/>  </hosts></dataCacheClient><fabric>  <sectionname="logging"path="">    <collectionname="sinks"collectionType="list">      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/>      <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/>    </collection>  </section></fabric><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web><system.web>  <sessionStatemode="Custom"customProvider="Velocity">    <providers>      <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/>    </providers>  </sessionState></system.web>
SummaryWindows Server AppFabric Cache is a distributed application cacheCaching is important to application scalabilityExplicit caching API available to .NET 3.5 SP1 and .NET 4.0ASP.NET Session provider an implicit way to take advantage of the Cache’s capabilitiesPlan, plan and plan some more
Questionsrobert@sadev.co.za@rmacleanMeet me at the community lounge
ResourcesRequired SlideLearningSessions On-Demand & CommunityMicrosoft Certification & Training Resourceswww.microsoft.com/techedwww.microsoft.com/learningResources for IT ProfessionalsResources for Developershttp://microsoft.com/msdnhttp://microsoft.com/technetNeed more Information?SMS [ Your Name ] and the word “AppServer” to 41491
Complete an evaluation via CommNet and Tag to win amazing prizes!
© 2008 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.

More Related Content

PPTX
App fabric introduction
PPTX
Microsoft Windows Server AppFabric
PPT
Building An Application For Windows Azure And Sql Azure
PPTX
App fabric hybrid computing
PDF
Azure appfabric caching intro and tips
PPTX
Introduction to Windows Azure AppFabric Applications
PPTX
Building Scalable .NET Web Applications
PPTX
DV03 Smooth Migration to Windows Azure
App fabric introduction
Microsoft Windows Server AppFabric
Building An Application For Windows Azure And Sql Azure
App fabric hybrid computing
Azure appfabric caching intro and tips
Introduction to Windows Azure AppFabric Applications
Building Scalable .NET Web Applications
DV03 Smooth Migration to Windows Azure

What's hot (18)

PDF
Architetture Serverless con SQL Server e Azure Functions
PPTX
Building & managing wa app wely
PPTX
BizSpark Startup Night Windows Azure March 29, 2011
PPTX
2011.05.31 super mondays-servicebus-demo
PDF
Cnam azure ze cloud resource manager
PPTX
Azure Automation and Update Management
PDF
Cloudformation & VPC, EC2, RDS
PPTX
Intro to Azure Static Web Apps
PPTX
Sherlock Homepage - A detective story about running large web services (VISUG...
PPTX
More Cache for Less Cash
PDF
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
PPTX
What's New for the Windows Azure Developer? Lots!!
PPTX
Become an Automation Ninja in 60 Minutes
PDF
Serverless Stream Processing with Bill Bejeck
PPTX
Azure Web App services
PDF
5 things you don't know about Amazon Web Services
PPTX
Automating Azure VMs with PowerShell
PPTX
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Architetture Serverless con SQL Server e Azure Functions
Building & managing wa app wely
BizSpark Startup Night Windows Azure March 29, 2011
2011.05.31 super mondays-servicebus-demo
Cnam azure ze cloud resource manager
Azure Automation and Update Management
Cloudformation & VPC, EC2, RDS
Intro to Azure Static Web Apps
Sherlock Homepage - A detective story about running large web services (VISUG...
More Cache for Less Cash
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
What's New for the Windows Azure Developer? Lots!!
Become an Automation Ninja in 60 Minutes
Serverless Stream Processing with Bill Bejeck
Azure Web App services
5 things you don't know about Amazon Web Services
Automating Azure VMs with PowerShell
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Ad

Similar to Windows Server AppFabric Caching - What it is & when you should use it? (20)

PPTX
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
PPT
Ajax to the Moon
ODP
Sun Web Server Brief
PPTX
Mike Taulty MIX10 Silverlight Frameworks and Patterns
PPTX
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
PPT
Introduction to Alfresco Surf Platform
PPT
Open Source Web Technologies
PPTX
Dave Orchard - Offline Web Apps with HTML5
PDF
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
PDF
Google App Engine for Java v0.0.2
PDF
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
PPTX
Windows Azure & How to Deploy Wordress
PPT
Ibm
PPTX
ASP.NET 4.0 Cache Extensibility
PDF
murakumo Cloud Controller
PPTX
What’s New in ASP.NET 4
PPTX
Joomla! Performance on Steroids
PDF
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
PPT
2310 b 15
PPT
2310 b 15
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
Ajax to the Moon
Sun Web Server Brief
Mike Taulty MIX10 Silverlight Frameworks and Patterns
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
Introduction to Alfresco Surf Platform
Open Source Web Technologies
Dave Orchard - Offline Web Apps with HTML5
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Google App Engine for Java v0.0.2
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
Windows Azure & How to Deploy Wordress
Ibm
ASP.NET 4.0 Cache Extensibility
murakumo Cloud Controller
What’s New in ASP.NET 4
Joomla! Performance on Steroids
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
2310 b 15
2310 b 15
Ad

More from Robert MacLean (20)

PPTX
Deno ...................................
PPTX
14 things you need to be a successful software developer (v3)
PPTX
OWASP TOP 10
PPTX
Building a µservice with Kotlin, Micronaut & GCP
PPTX
Looking at the Vue
PPTX
Kotlin 101
PPTX
Features of Kotlin I find exciting
PPTX
JavaScript Gotchas
PPTX
DevConf Survival Guide
PPTX
The state of testing @ Microsoft
PPTX
Visual Studio ❤ JavaScript
PPTX
What is new in C# 6?
PPTX
Putting the DOT in .NET - Dev/Ops/Test
PPTX
A Developer Day 2014 - Durban
PPTX
Agile lessons learned in the Microsoft ALM Rangers
PPTX
Hour of code - Train the trainer
PPTX
Building services for apps on a shoestring budget
PPTX
3 things your app API is doing WRONG
PPTX
Deno ...................................
14 things you need to be a successful software developer (v3)
OWASP TOP 10
Building a µservice with Kotlin, Micronaut & GCP
Looking at the Vue
Kotlin 101
Features of Kotlin I find exciting
JavaScript Gotchas
DevConf Survival Guide
The state of testing @ Microsoft
Visual Studio ❤ JavaScript
What is new in C# 6?
Putting the DOT in .NET - Dev/Ops/Test
A Developer Day 2014 - Durban
Agile lessons learned in the Microsoft ALM Rangers
Hour of code - Train the trainer
Building services for apps on a shoestring budget
3 things your app API is doing WRONG

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
cuic standard and advanced reporting.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
cuic standard and advanced reporting.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
Review of recent advances in non-invasive hemoglobin estimation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Windows Server AppFabric Caching - What it is & when you should use it?

  • 2. Robert MacLeanTechnology SpecialistBB&DWindows Server AppFabric Caching: What it is & When you should use it?
  • 3. Who am I?Robert MacLeanMicrosoft ALM MVPMicrosoft ALM RangerProud Community Lead Information WorkerS.A. Architectwww.sadev.co.za@rmaclean
  • 4. OvertureLevel 300State of playBriefly what is AppFabric?What do we get from AppFabric Caching and how to use it!
  • 5. Advert TimeAppFabric:Wed, 11:15pm - WCF Made Easy with .NET 4 and Windows Server AppFabricOther:Wed, 8:30pm - Tales From the field – Best practices and guidance on implementing TFS2010
  • 6. State of play.NET prior to 4ASP.NET CachingEnterprise Library Caching.NET 4 brings us.NET 4 CachingAll are local in-memory caches!
  • 8. What is the issue with these?Limited to memory of current machineLimited to current processImagine if I need 50Gb of cache?What about load balancing?
  • 9. A rose by any other name…Windows Server AppFabric contains two key componentsHostingEndPoint, Windows App Server Extensions, DublinCachingVelocityNot to be confused with Azure AppFabric
  • 10. N.B. AppFabricRequires .NET 4 on ServerNot all applications need .NET 4, depends on features usedStandalone download or Web Platform InstallerHigh Availability is only in Windows Server 2008 Enterprise & Data Centre
  • 11. What is AppFabric Cache?An in-memory distributed cache which you can call from any .NET applicationOptimised for the cache-aside patternProgramming against the cache is explicitChanging the cache doesn’t update the original data store
  • 12. AppFabric Cache Single ViewCache ServerSingle view from codeServicesCache ServerData 1Data 2Data 3Data 4Cache ServerCache Server
  • 13. AppFabric Caching InfoCommon Configuration StoreXMLDatabaseRuns as Windows ServiceCommunication Between NodesWCF net.tcpSelf Adjusting
  • 14. AppFabric Server TypesDedicated Cache ServerAll it does is AppFabric caching – good for lots of memory and great performationHybrid Cache ServerRuns AppFabric caching & other tools. SQL + AppFabricWeb + AppFabricLocal Cache ServerRuns AppFabric per application locallyUsed in conjunction with hybrid and/or dedicated
  • 15. What can I cache?Anything that can be serialisedXMLPOCOBinary Data
  • 16. Data Cache PlanningReference DataCities, provinces, product info, etc…Activity DataSession, per user etc..Resource DataData with contention We will look at this more later…NB: Plan, plan and plan some more
  • 17. ManagementAll Configuration and Administration is done via PowerShellFrom the MVP’s: http://mdcadmintool.codeplex.com/
  • 18. AppFabric from IT Pro to DeveloperDemo
  • 19. Cache Structure ReviewServerServerServerNamed Cache: DefaultNamed Cache: ProductsNamed Cache: UsersRegion: MaleRegion: FemaleItems & Tags
  • 20. Expiration of cache itemsPut & AddTimeoutNotificationPolling Default: 300 secsExpiration timeout defaults can be controlled on a cache level
  • 21. Eviction@ Low watermarkExpired items removed@ High watermarkItems, expired or not, can be removed or allocated to another serverItems picked by using LRU Can disable if needed
  • 22. ORM’sSome ORM’s implement second level cachingIt is possible to change the second level to AppFabricExamples: NHibernate & Entity Framework
  • 23. A Problem with Caching AppFabric CacheName : RobertBalance: 1500WriteDBName : RobertBalance: 15ATMATMORMUIORMUIName : RobertBalance: 15
  • 24. Solution.GetAndLock.PutAndUnlock.UnlockSupports locking timeoutLocked items can survive expirationUnlock can prolong expiration
  • 25. Data Cache PlanningReference DataCities, provinces, product info, etc…Activity DataSession, per user etc..Resource DataData with contention NB: Plan, plan and plan some moreGreat with defaultsRegion per userLocking per item
  • 26. Cluster ConfigurationFirst node initialises clusterOther nodes joinDuring install you must configure projected sizeSmall: 1 – 5 nodes Medium: 6 – 15 nodesLarge: > 15 nodesPerformance based on this setting – adding/removing nodes does not effect this
  • 27. SecurityDomain:Authentication in AD, Authorisation in AppFabricOnly authorised servers join clustersOnly authorised clients connect to clustersWorkgroupAuthentication in network share, Authorisation in AppFabricTransport Level SecuritySigning and Encryption
  • 28. Typical Web ArchitectureUsersWeb ServersLoad BalancerStateStateStateDB
  • 29. ASP.NETOut of the box caching InProc (Default)StateServerSQLServerAll can be enabled by via config changeNow AppFabric support also just a config change
  • 30. ASP.NET AppFabricConfig<configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient><fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/> </collection> </section></fabric><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web>
  • 31. ASP.NET AppFabricConfig<configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient><fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/> </collection> </section></fabric><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web><configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections>
  • 32. ASP.NET AppFabricConfig<configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient><fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/> </collection> </section></fabric><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient>
  • 33. ASP.NET AppFabricConfig<fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> … </collection> </section></fabric><configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient><fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/> </collection> </section></fabric><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web>
  • 34. ASP.NET AppFabricConfig<configSections> <sectionname="dataCacheClient“type="Microsoft.Data.Caching.DataCacheClientSection, CacheBaseLibrary" allowLocation="true"allowDefinition="Everywhere"/> <sectionname="fabric“type="System.Data.Fabric.Common.ConfigFile, FabricCommon“ allowLocation="true"allowDefinition="Everywhere"/></configSections><dataCacheClientdeployment="routing"> <localCacheisEnabled="false"/> <hosts> <hostname="localhost"cachePort="22233“ cacheHostName="DistributedCacheService"/> </hosts></dataCacheClient><fabric> <sectionname="logging"path=""> <collectionname="sinks"collectionType="list"> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.ConsoleSink,FabricCommon"sinkParam=""defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon"sinkName="System.Data.Fabric.Common.FileEventSink,FabricCommon"sinkParam="DcacheLog/dd-hh-mm"defaultLevel="-1"/> <customTypeclassName="System.Data.Fabric.Common.EventLogger,FabricCommon“ sinkName="Microsoft.Data.Caching.ETWSink, CacheBaseLibrary“ sinkParam=""defaultLevel="-1"/> </collection> </section></fabric><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web><system.web> <sessionStatemode="Custom"customProvider="Velocity"> <providers> <addname="Velocity"type="Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary"cacheName="session"/> </providers> </sessionState></system.web>
  • 35. SummaryWindows Server AppFabric Cache is a distributed application cacheCaching is important to application scalabilityExplicit caching API available to .NET 3.5 SP1 and .NET 4.0ASP.NET Session provider an implicit way to take advantage of the Cache’s capabilitiesPlan, plan and plan some more
  • 37. ResourcesRequired SlideLearningSessions On-Demand & CommunityMicrosoft Certification & Training Resourceswww.microsoft.com/techedwww.microsoft.com/learningResources for IT ProfessionalsResources for Developershttp://microsoft.com/msdnhttp://microsoft.com/technetNeed more Information?SMS [ Your Name ] and the word “AppServer” to 41491
  • 38. Complete an evaluation via CommNet and Tag to win amazing prizes!
  • 39. © 2008 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.
  • 41. AgendaAgenda SubtitleAgenda item 1Agenda subheadingAgenda Item 2Agenda subheadingAgenda item 3Agenda subheadingEtc…
  • 43. PowerPoint TemplateSubtitle colorExample of a slide with a subheadSet the slide header to “Title Case”Set subheads in “sentence case”Generally set subhead to 36pt or smaller so it will fit on asingle lineThe subhead color is defined for this template but mustbe selected
  • 44. Sample FillSample FillPowerPoint GuidelinesFont, size, and color for text have been formatted for you in the Slide MasterUse the color palette shown belowHyperlink color: www.microsoft.comSample FillSample FillSample FillSample Fill
  • 45. Slide for Showing Software CodeUse this layout to show software codeThe font is Consolas, a monospace fontThe slide doesn’t use bullets but levels can be indented using the “Increase List Level” icon on the Home menuTo use straight quotes " instead of smart quotes ”, do this:Click on the Office Button in the upper left cornerAt the bottom of the menu, choose PowerPoint OptionsFrom the left pane, select ProofingClick on the AutoCorrect Options buttonSelect the AutoFormat As You Type tab, and deselect “Straight quotes” with “smart quotes”. Then Click OK.
  • 49. Breakout sessionsBreakout sessionsBreakout sessionsBreakout sessionsRelated Content