Scale Your Data Tier with Windows Server AppFabric<br />Chris Dufour, ASP MVP<br />Software Architect, Compuware<br />chri...
Agenda<br />
Simple<br />Do the simplest thing that will possibly work<br />
Scalability<br />Able to support the required quality of service as the system load increases<br />-Wiktionary<br />
Typical Web Architecture<br />
Web Explosion<br />Web Site’s too slow!!<br />Where did my shopping cart go?<br />IIS/ASP.NET<br />IIS/ASP.NET<br />IIS/AS...
Agenda<br />
Data Near Processing<br />Cache<br />Cache<br />Browser<br />Smart Client<br />Cache<br />Web Service<br />Cache<br />ASP....
Good but…<br />Cache is scoped to machine  / process<br />Machines die<br />Processes recycle<br />Cache memory is limited...
What if?<br />You could have as much cache as you wanted?<br />You could share a giant cache across servers, services and ...
Windows Server AppFabric<br />AppFabric<br />CACHING<br />WORKFLOW HOSTING<br />SERVICE HOSTING<br />MONITORING<br />SCALE...
Unified Cache View<br />What is AppFabric Caching?<br />An explicit, distributed, in-memory application cache for all kind...
AppFabric Cache<br />
Data Distribution - Partitioned Cache<br />…<br />Web Tier<br />ASP.Net App<br />ASP.Net App<br />ASP.Net App<br />Caching...
Scale Test Output<br />Load<br />1 Cache Server<br />As load increases, <br />throughput fails <br />to scale <br />latenc...
Add a Second Cache Server<br />Load<br />Load Max<br />Throughput increases<br />Latency decreases<br />Caching Tier<br />...
Add a Second Cache Server<br />Load<br />Caching Tier<br />Throughput<br />Latency<br />
Associated Press<br />Caches metadata and news<br />Serves 16 million hits per day<br />Increased the amount of cached dat...
System.Web.Cache<br />
AppFabricDataCache<br />
Copy Client DLLs<br />Update Web.config<br />…<br />.NET 3.5 SP1 OR .NET 4<br /><hosts><br />      <host name="BL1CDB80837...
Usage Pattern – Cache Aside  (Explicit Caching)<br />//  Read from Cache<br />Toy toyObj = (Toy)<br />catalog.Get("toy-101...
Administration<br />PowerShell cmdlets are used to administer the cache cluster	<br />Rich set of cmdlets for <br />Cache ...
Hello AppFabric Cache<br />
Using PowerShell<br />Remember – PowerShell can also be called from .NET Code!<br />
Security<br />Domain Based Security Option<br />Domain Account / Local Account based Authentication<br />Only authorized s...
Logical Hierarchy<br />AppFabric Caching Service<br />AppFabric Caching Service<br />AppFabric Caching Service<br />AppFab...
AppFabric Caching API<br />// Create instance of cachefactory (reads appconfig)<br />DataCacheFactory fac = new DataCacheF...
Access APIs – Tagging Items<br />Tag hotItem  = new Tag("hotItem");<br />catalog.Put("toy-101", new Toy("Puzzle"),<br />ne...
Types of Data<br />Grocery Shop<br /> Web Tier<br />Shopping Cart<br />Grocery Inventory<br />Distributed Cache<br />     ...
Reference Data – Performance<br />Catalog data doesn’t change often<br />Unnecessary network cost to access from different...
Reference Data – Bulk Get<br />Bulk Fetch from region<br />200-300k ops per second<br />Fewer network calls<br />Catalog.B...
Activity Data – Session Integration<br />Load Balance Requests<br />No more sticky routing<br /><sessionState  mode="Custo...
Application<br />Application<br />Activity Data - Availability<br />PUT<br />Get(K2)<br />AppFabric Caching Client<br />Ap...
Resource Data - Optimistic Locking<br />GetCacheItem returns a version object<br />Every update to an object internally in...
Resource Data - Pessimistic Locking<br />Client1: <br />GetAndLock ("k1")<br />Client3:<br /> Get ("k1")<br />Client2:<br ...
Data Race<br />GET<br />GET<br />GET<br />
Lock Non-Existent Key<br />GET/LOCK<br />GET/LOCK<br />GET/LOCK<br />Cache  Service<br />Cache  Service<br />Caching  Serv...
Composite Race<br />CALL<br />WAIT<br />WAIT<br />Cache  Service<br />Cache  Service<br />Caching  Service<br />
Composite Race<br />PUT<br />UNLOCK<br />GET<br />GET<br />Cache  Service<br />Cache  Service<br />Caching  Service<br />
Resource/Activity Data – Tracking Changes<br />Cache Event notifications<br />Register on any client to notify changes<br ...
Register Notification for Key “K3"<br />Call Delegate<br />Store Last LSN <br />Application<br />Map Keys to Partition<br ...
Agenda<br />
Pre-Fetch<br />Hospital<br />Data Center<br />
Pre-Fetch<br />Remote Clinic<br />Hospital<br />Slow!!<br />Data Center<br />WAN<br />
Pre-Fetch<br />Hospital<br />Remote Clinic<br />Data Center<br />Cache  Service<br />WAN<br />
Agenda<br />
Web Platform Installer<br />
Select Enterprise<br />
Install AppFabric<br />
Install AppFabric<br />
endpoint.tv<br />
AppFabric on MSDN<br />http://msdn.microsoft.com/AppFabric<br />
Upcoming SlideShare
Loading in...5
×

Scale Your Data Tier With Windows Server App Fabric

3,554

Published on

The distributed in-memory caching capabilities of Windows Server AppFabric will change how you think about scaling your Microsoft .NET-connected applications. Come learn how the distributed nature of the AppFabric cache allows large amounts of data to be stored in-memory for extremely fast access, how AppFabric's integration with Microsoft ASP.NET makes it easy to add low-latency data caching across the web farm, and discover the unique high availability features of AppFabric which will bring new degrees of scale and resilience to your data tier and your web applications.

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,554
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
92
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • In the future we will be bringing these capabilities to the cloud and bringing some of the cloud capabilities such as service bus and access control to the on-premise server solution as well.
  • Scale Your Data Tier With Windows Server App Fabric

    1. 1. Scale Your Data Tier with Windows Server AppFabric<br />Chris Dufour, ASP MVP<br />Software Architect, Compuware<br />chris.dufour@wigets.net<br />
    2. 2. Agenda<br />
    3. 3. Simple<br />Do the simplest thing that will possibly work<br />
    4. 4. Scalability<br />Able to support the required quality of service as the system load increases<br />-Wiktionary<br />
    5. 5. Typical Web Architecture<br />
    6. 6. Web Explosion<br />Web Site’s too slow!!<br />Where did my shopping cart go?<br />IIS/ASP.NET<br />IIS/ASP.NET<br />IIS/ASP.NET<br /> Application<br /> Application<br /> Application<br />Servers are crashing<br />Database<br />Database is hot!!<br />Services are slow<br />
    7. 7. Agenda<br />
    8. 8. Data Near Processing<br />Cache<br />Cache<br />Browser<br />Smart Client<br />Cache<br />Web Service<br />Cache<br />ASP.NET<br />Cache<br />Database<br />
    9. 9. Good but…<br />Cache is scoped to machine / process<br />Machines die<br />Processes recycle<br />Cache memory is limited<br />
    10. 10. What if?<br />You could have as much cache as you wanted?<br />You could share a giant cache across servers, services and even clients?<br />What if this was something you could simply add to the platform for 1free?<br />1Some features may require certain editions of Windows Server <br />
    11. 11. Windows Server AppFabric<br />AppFabric<br />CACHING<br />WORKFLOW HOSTING<br />SERVICE HOSTING<br />MONITORING<br />SCALE OUT<br />HIGH AVAILABILITY <br />MANAGEMENT<br />
    12. 12. Unified Cache View<br />What is AppFabric Caching?<br />An explicit, distributed, in-memory application cache for all kinds of data <br />Caching clients can be across machines or processes<br />Clients Access the Cache as if it was a large single cache<br />Cache Layer distributes data across the various cache nodes<br />
    13. 13. AppFabric Cache<br />
    14. 14. Data Distribution - Partitioned Cache<br />…<br />Web Tier<br />ASP.Net App<br />ASP.Net App<br />ASP.Net App<br />Caching Client<br />Caching Client<br />Caching Client<br />G<br />H<br />I<br />D<br />E<br />F<br />A<br />B<br />C<br />Cache Service<br />Cache Service<br />Cache Tier<br />Cache Service<br />E<br />G<br />B<br />D<br />H<br />A<br />I<br />C<br />F<br />Scale on Data Size<br />More machines => More memory to cache<br />Scale on Cache Throughput<br />More machines => keys distributed across more machines => better throughput<br />
    15. 15. Scale Test Output<br />Load<br />1 Cache Server<br />As load increases, <br />throughput fails <br />to scale <br />latency increases<br />Caching Tier<br />Throughput<br />Latency<br />
    16. 16. Add a Second Cache Server<br />Load<br />Load Max<br />Throughput increases<br />Latency decreases<br />Caching Tier<br />Throughput<br />Latency<br />
    17. 17. Add a Second Cache Server<br />Load<br />Caching Tier<br />Throughput<br />Latency<br />
    18. 18. Associated Press<br />Caches metadata and news<br />Serves 16 million hits per day<br />Increased the amount of cached data 6 times.<br />
    19. 19. System.Web.Cache<br />
    20. 20. AppFabricDataCache<br />
    21. 21. Copy Client DLLs<br />Update Web.config<br />…<br />.NET 3.5 SP1 OR .NET 4<br /><hosts><br /> <host name="BL1CDB8083714“<br />cachePort="22233" <br />cacheHostName="DistributedCacheService"/><br /> …..<br /> </hosts><br /> <localCacheisEnabled=“true" ../><br /><security … /><br /> Application<br /> Application<br /> Application<br />Caching Access Layer<br />Caching Access Layer<br />Caching Access Layer<br />.NET 4<br />Install AppFabric<br />Configure AppFabric<br />Caching Service<br />Caching Service<br />Caching Service<br />Configuration Store <br />Deployment<br />
    22. 22. Usage Pattern – Cache Aside (Explicit Caching)<br />// Read from Cache<br />Toy toyObj = (Toy)<br />catalog.Get("toy-101");<br /> Application<br />Caching Access Layer<br />// If Not present in the cache<br />if (toyObj == null)<br />{<br /> // Read from backend..<br /> toyObj = ReadFromDatabase();<br /> // Populate Cache<br />catalog.Put("toy-101", toyObj);<br /> return toyObj;<br />}<br />Caching Service<br />Database<br />
    23. 23. Administration<br />PowerShell cmdlets are used to administer the cache cluster <br />Rich set of cmdlets for <br />Cache cluster management<br />Cache creation and monitoring<br />
    24. 24. Hello AppFabric Cache<br />
    25. 25. Using PowerShell<br />Remember – PowerShell can also be called from .NET Code!<br />
    26. 26. Security<br />Domain Based Security Option<br />Domain Account / Local Account based Authentication<br />Only authorized servers can join the cluster<br />Only authorized clients can connect to the cluster<br />Transport Level Security<br />Turn on/off Signing or Encryption<br />Can turn off Cache Security<br />Use Firewalls, IPSec, VLANs to protect cache<br />grant-cacheallowedclientaccount  RedDomainMachine1$<br /> grant-cacheallowedclientaccount  RedDomainJohn<br />
    27. 27. Logical Hierarchy<br />AppFabric Caching Service<br />AppFabric Caching Service<br />AppFabric Caching Service<br />AppFabric Caching Service<br />Named Cache : Product Catalog<br />Named Cache : Electronics Inventory<br />Regions <br />Key Payload Tags <br />Region A<br />121 xxxx “Toy” “Child”<br />123 yyyy “Toy” “Chair”.. <br />Machine<br />Host<br />Physical processes hosting AppFabric Caching instance.<br />Named Caches<br />Can span across machines<br />Defined in the configuration file<br />Regions<br />Physically co-located Container of Cache Items<br />May be implicit or explicitly created<br />Cache Item<br />Key, Payload (Object ), Tags, TTL, Timestamps, Version<br />
    28. 28. AppFabric Caching API<br />// Create instance of cachefactory (reads appconfig)<br />DataCacheFactory fac = new DataCacheFactory();<br />// Get a named cache from the factory<br />DataCache catalog = fac.GetCache("catalogcache");<br />// Simple Get/Put<br />catalog.Put("toy-101", new Toy("Puzzle", .,.));<br />// From the same or a different client<br />Toy toyObj = (Toy)catalog.Get("toy-101");<br />// Region based Get/Put<br />catalog.CreateRegion("toyRegion");<br />// Both toy and toyparts are put in the same region <br />catalog.Put("toy-101", new Toy( .,.), “toyRegion”);<br />Catalog.Put("toypart-100", new ToyParts(…), “toyRegion”);<br />Toy toyObj = (Toy)catalog.Get("toy-101“,"toyRegion");<br />
    29. 29. Access APIs – Tagging Items<br />Tag hotItem = new Tag("hotItem");<br />catalog.Put("toy-101", new Toy("Puzzle"),<br />new Tag[]{hotItem}, “toyRegion”);<br />catalog.Put("toy-102", new Toy("Bridge"), “toyRegion”);<br />// From the same or a different client<br />List<KeyValuePair<string, object>> toys = <br />catalog.GetAnyMatchingTag("toyRegion", hotItem);<br />
    30. 30. Types of Data<br />Grocery Shop<br /> Web Tier<br />Shopping Cart<br />Grocery Inventory<br />Distributed Cache<br /> Grocery Catalog<br />
    31. 31. Reference Data – Performance<br />Catalog data doesn’t change often<br />Unnecessary network cost to access from different machines<br />Solution – Local Cache<br />Application<br />Application<br />Get(K2)<br />Get(K2)<br />Put(K2, v3)<br />AppFabric Caching Client<br />AppFabric Caching Client<br />Local Cache<br />RoutingTable<br />Routing Table<br />Cache2<br />Cache3<br />Cache1<br />K2, V2<br />K2, V2<br />Primary for K1,V1<br />Primary for K3,V3<br />Primary for K2,V2<br />K1, V1<br />K2, V3<br />K3, V3<br />
    32. 32. Reference Data – Bulk Get<br />Bulk Fetch from region<br />200-300k ops per second<br />Fewer network calls<br />Catalog.BulkGet( <br /> new List<string>(){“toy-101”, “toy-102”} ,<br /> “toyRegion”);<br />
    33. 33. Activity Data – Session Integration<br />Load Balance Requests<br />No more sticky routing<br /><sessionState mode="Custom“ customProvider="SessionStoreProvider"><br /><providers><br /> <add name="SessionStoreProvider" <br /> type=“Microsoft.Data.Caching.DataCacheSessionStoreProvider, <br />ClientLibrary“ <br />cacheName="<YourNamedCache>"/><br /></providers><br /></sessionState><br />Drop in AppFabric Caching SessionStoreProvider<br />…<br />Caching Access Layer<br />Caching Access Layer<br />Session State stored in AppFabric Caching<br />Allows session state to be shared amongst multiple applications<br />Scale your Session Store<br />Dynamically<br />Cache Service<br />Caching Service<br />Caching Service<br />Highly Available<br /> Application<br /> Application<br /> Application<br />Caching Access Layer<br />
    34. 34. Application<br />Application<br />Activity Data - Availability<br />PUT<br />Get(K2)<br />AppFabric Caching Client<br />AppFabric Caching Client<br />Routing Table<br />Routing Table<br />Cache1<br />Cache2<br />Cache3<br />Primary for<br />Primary for<br />Primary for <br />Replication Agent<br />K3, V3<br />K1, V1<br />K2, V2<br />(K2, V2)<br />K2, V2<br />Secondary for<br />Secondary for <br />Secondary for<br />K2, V2<br />K2, V2<br />K3, V3<br />K1, V1<br />
    35. 35. Resource Data - Optimistic Locking<br />GetCacheItem returns a version object<br />Every update to an object internally increments it's version<br />Supply the version obtained along with the Put/Remove<br />Put/Remove will succeed only if the passed in version matches the version in the cache <br />Two clients access the same item <br />Both update the item<br />Second Client gets in first; put succeeds because item version matches; atomically increments the version<br />First client tries put;<br />Fails because the versions don’t match<br />
    36. 36. Resource Data - Pessimistic Locking<br />Client1: <br />GetAndLock ("k1")<br />Client3:<br /> Get ("k1")<br />Client2:<br /> GetAndLock ("k1")<br />GetAndLock gets lock handle<br />Regular Get succeeds<br /> Other GetAndLock on same item fails<br />Take locks on non-existent keys<br />Allows you to co-ordinate calls for data<br />K1<br />
    37. 37. Data Race<br />GET<br />GET<br />GET<br />
    38. 38. Lock Non-Existent Key<br />GET/LOCK<br />GET/LOCK<br />GET/LOCK<br />Cache Service<br />Cache Service<br />Caching Service<br />
    39. 39. Composite Race<br />CALL<br />WAIT<br />WAIT<br />Cache Service<br />Cache Service<br />Caching Service<br />
    40. 40. Composite Race<br />PUT<br />UNLOCK<br />GET<br />GET<br />Cache Service<br />Cache Service<br />Caching Service<br />
    41. 41. Resource/Activity Data – Tracking Changes<br />Cache Event notifications<br />Register on any client to notify changes<br />Batched Notifications<br />DataCache.RegisterCacheLevelCallback(<br />int filter, DataCacheChangeCallback delegate); <br />DataCache.RegisterRegionLevelCallback(<br /> String region, int filter, DataCacheChangeCallback delegate); <br />DataCache.RegisterKeyLevelCallback(<br /> String region, String key, int filter, DataCacheChangeCallback delegate); <br />
    42. 42. Register Notification for Key “K3"<br />Call Delegate<br />Store Last LSN <br />Application<br />Map Keys to Partition<br />AppFabric Caching Client<br />Partition: P2<br />Last LSN: 19<br />Routing Table<br />Poll Required Nodes<br />Nodes Return List of Changes LSN Order<br />Cache2<br />Cache3<br />Cache1<br />K2, V2<br />Primary for<br />Primary for<br />Primary for<br />Change Log (Partition P2)<br />Del K32<br />Del K43<br />Change Log<br />Partition P1<br />Add K2<br />Del K32<br />Change Log<br />33 Add K1<br />34 Del K22<br />K1, V1<br />K3, V3<br />Scalable Notifications<br />
    43. 43. Agenda<br />
    44. 44. Pre-Fetch<br />Hospital<br />Data Center<br />
    45. 45. Pre-Fetch<br />Remote Clinic<br />Hospital<br />Slow!!<br />Data Center<br />WAN<br />
    46. 46. Pre-Fetch<br />Hospital<br />Remote Clinic<br />Data Center<br />Cache Service<br />WAN<br />
    47. 47. Agenda<br />
    48. 48. Web Platform Installer<br />
    49. 49. Select Enterprise<br />
    50. 50. Install AppFabric<br />
    51. 51. Install AppFabric<br />
    52. 52. endpoint.tv<br />
    53. 53. AppFabric on MSDN<br />http://msdn.microsoft.com/AppFabric<br />
    54. 54. Thanks to our contributors<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×