Application Scalability in Server Farms - NCache

1,602 views
1,414 views

Published on

NCache is an in-memory caching solution by Alachisoft that improves application scalability and performance by reducing database trips and storing frequently accessed data in memory to provide better performance. It is also used to cache session data in web farms.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,602
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Application Scalability in Server Farms - NCache

  1. 1. Alachisoft .NET Performance Solutions Scaling .NET Apps with In-Memory Distributed Cache Boost app performance under peak loads! Iqbal Khan iqbal@alachisoft.com Ph: +1 (925) 236-2125 www.alachisoft.com 1
  2. 2. Alachisoft What is Scalability? Ability to increase transaction load on applications… without slowing them down NCache www.alachisoft.com 2
  3. 3. Alachisoft What is Linear (Unlimited) Scalability? NCache www.alachisoft.com 3
  4. 4. Alachisoft Following Applications Need Scalability 1. ASP.NET Apps  2. WCF & .NET Web Services  3. To quickly process very large amounts of data thru distribution Grid Computing Apps  5. To handle millions of requests Big Data Apps  4. To handle millions of users To process very large computations thru distribution Other .NET Server Apps  NCache To handle millions of requests www.alachisoft.com 4
  5. 5. Alachisoft What is the Scalability Problem? 1. Application Architectures can Scale Linearly  2. Use a load balancer and simply add more app servers Data Storage has Scalability Bottlenecks!   NCache Cannot handle high transaction loads Cannot keep adding database servers www.alachisoft.com 5
  6. 6. Alachisoft Data Storage is Scalability Bottleneck ASP.NET/WCF Example App Database ASP.NET/WCF Servers Database Servers Data Access Scale Web Farm Web Clients Http Calls ... NCache Load Balancer www.alachisoft.com ASP.NET Session Storage 6
  7. 7. Alachisoft The Solution Scalable In-Memory Distributed Cache NCache NCache www.alachisoft.com 7
  8. 8. Alachisoft What is an In-Memory Distributed Cache? 1. Cluster of multiple inexpensive cache servers  2. Synchronizes cache updates across all cache servers  3. Cache updates are immediately visible from all cache servers Linearly scales transaction & memory capacity  4. Pools their memory and CPU into one logical capacity Just add more cache servers to grow capacity Replicates data for reliability  NCache Intelligent replication without compromising performance & scalability www.alachisoft.com 8
  9. 9. Alachisoft NCache: In-Memory Distributed Cache ASP.NET Web Apps WCF Web Services Grid Computing Apps (.NET) .NET Server Apps Distributed Cache Cluster Memory pooled from all cache servers Scale Horizontally Windows 2008/2012 (64-bit) Filesystem NCache Database Servers www.alachisoft.com Mainframe 9
  10. 10. Alachisoft Three Common Uses of Distributed Cache 1. App Data Caching (for Database Bottlenecks)   2. Reliable & Scalable Cache for ASP.NET Specific Data    3. In-memory cache faster than database Cache linearly scalable which database is not ASP.NET Session State storage (most common) ASP.NET View State cache ASP.NET Output Cache provider Scalable Runtime Data Sharing thru Messaging    NCache Faster & more scalable than traditional message queues Async data sharing in producer/consumer model Powerful event notifications & continuous queries for app coordination www.alachisoft.com 10
  11. 11. Alachisoft What Data to Cache? 1. Permanent Data   2. Transient (temporary) Data    3. Data goes away after a short period (minutes, hours, or days) No need to keep it in database ASP.NET Session State, ASP.NET View State, ASP.NET Output Cache Reference Data   4. Master copy of data exists in the database Caching it reduces expensive database trips Does not change very frequently (but is not static) This is usually permanent data Transactional Data  NCache Changes frequently (as frequently as in a few seconds) www.alachisoft.com 11
  12. 12. Alachisoft Overview of Caching API  Cache appears as a Hashtable-like interface   Each item has a string-based key and an “object” as its value. String based keys contain type information    NCache “Employee:1000”: Employee with EmployeeId = 1000 “Employee:Orders:1000”: Employee 1000’s related Order collection “Employee:Query:FindByTitle:Mgr”: Employee collection returned by query “FindByTitle” with “Mgr” as runtime parameter www.alachisoft.com 12
  13. 13. Alachisoft Overview of Caching API  Connect & Disconnect from the Cache    Read from the Cache       cache.Add(“myKey”, obj); cache.Insert(“myKey”, obj); cache[“myKey”] = obj; Remove from the Cache   object obj = cache.Get(“myKey”); object obj = cache[“myKey”]; bool isPresent = cache.Contains(“myKey”); Add to the Cache   Cache cache = NCache.InitializeCache(“myReplicatedCache”); cache.Dispose(); object obj = cache.Remove(“myKey”); Empty the Cache  NCache cache.Clear(); www.alachisoft.com 13
  14. 14. Alachisoft Cache Elasticity (100% Uptime) Dynamic Cache Cluster  TCP based Cache Cluster   No single point of failure Add/remove servers at runtime    Does not use Windows Clustering Peer to peer architecture   Remote Clients (Web/App Servers) Without stopping cache or your app Data adjusted automatically based on caching topology Add Server At Runtime Hot Apply config changes  Cache Cluster NCache Srv NCache Srv Remove Server At Runtime Change config properties while cache is running NCache Srv NCache www.alachisoft.com 14
  15. 15. Alachisoft Cache Elasticity (100% Uptime) Dynamic Configuration  Cluster membership info   Propagate to clients at runtime Cache topology info    Remote Clients (Web/App Servers) Propagate to clients at runtime Connection strategy at runtime Cluster Membership Info Connection failover  Cache Topology Info Clients auto-connect to other servers NCache Srv NCache Srv NCache Srv Dynamic Cache Cluster NCache www.alachisoft.com 15
  16. 16. Alachisoft Caching Topologies Mirrored Cache (2-node active/passive)  All clients connect to active node Mirrored Cache Remote Clients (Web/App Servers)    Passive node becomes active if active node goes down. Clients also automatically connect to new active node Mirroring to passive node done asynchronously Recommended use:  Up to 10 app servers  2 cache server cluster Server 1 1 3 Server 2 2 Active 5 1 4 3 6 2 Passive (Backup) 5 4 6 Async Backup NCache www.alachisoft.com 16
  17. 17. Alachisoft Caching Topologies Replicated Cache  Each server has the entire cache Replicated Cache Remote Clients (Web/App Servers)    Cache updates done to all servers synchronously. So, they’re slower. Each clients connects to only one cache server. All servers active. Good for read-intensive scenarios Server 1 1 3 Server 2 2 Active 5 1 4 6 3 2 Active 5 4 6 Synchronous Updates NCache www.alachisoft.com 17
  18. 18. Alachisoft Caching Topologies Partitioned Cache  Extremely scalable Partitioned Cache Remote Clients (Web/App Servers)  Location transparency  Good for large cache clusters   Distribution map sent to all clients at runtime Distribution Map Distribution Map No replication available Partition 1 1 2 Server 1 NCache www.alachisoft.com Partition 2 3 4 Server 2 18
  19. 19. Alachisoft Caching Topologies Partition-Replica Cache  Each partition has one replica on a different server. All created automatically.  Remote Clients (Web/App Servers) Async & Sync replication options  Partition-Replica Cache Extremely fast & scalable  Reliability due to replicas Distribution Map Distribution Map Partition 1 1 2 Replica 2 3 4 Server 1 NCache www.alachisoft.com Partition 2 3 4 Replica 1 1 2 Server 2 19
  20. 20. Alachisoft Caching Topologies Client Cache NCache Client Nodes    Local cache on client nodes (inprocess and out-of-process) Automatically synchronizes with clustered cache. Optimistic & pessimistic synch options. ... Web/App Server (Client Node) Web/App Server (Client Node) Client Cache Client Cache Synchronized No special programming needed. Plug in thru config changes. Synchronized Cache Cluster Dynamic Clustered Cache Server 1  Good for read-intensive scenarios 1 Server 2 2 3 1 5 2 5 4 6 3 6 4 Server 3 1 2 5 6 3 4 Cached Item NCache www.alachisoft.com 20
  21. 21. Alachisoft Caching Topologies Performance Data NCache Performance Benchmarks NCache www.alachisoft.com 21
  22. 22. Alachisoft WAN Replication of Distributed Cache Active-Passive Configuration Primary Site (Active) Disaster Recovery Site NCache Client Nodes Remote Client (.NET) Remote Client (.NET) ... NCache Client Nodes Remote Client (Java) Remote Client (.NET) Remote Client (.NET) Cache Cluster Server 1 Server 2 .NET Client NCache NCache Server 1 Replicate (WAN) Server 2 (Passive Mirror) www.alachisoft.com Java Client NCache Server 1 (Active) Server 2 .NET Client Bridge Server 3 NCache Remote Client (Java) Cache Cluster Java Client NCache ... NCache Server 3 NCache 22
  23. 23. Alachisoft WAN Replication of Distributed Cache 1. Active-Passive  2. Hub-spoke  3. One active and multiple passive Active-Active  4. One active and one passive Two active sites STAR  NCache One central active site and multiple satellite active sites www.alachisoft.com 23
  24. 24. Alachisoft Hands on Demo NCache www.alachisoft.com 24
  25. 25. Alachisoft Some Object Caching Features  Expirations    Locking (Pessimistic & Optimistic)    Lock/Unlock for pessimistic locking (writer-lock) Object versioning for optimistic locking (reader-lock) Bulk Operations   Absolute-time + idle-time Auto-reload data on expiration (if read-thru enabled) Bulk Get, Add, Insert, and Remove Async Operations  NCache Async Add, Insert, and Remove www.alachisoft.com 25
  26. 26. Alachisoft Handling Relational Data in Cache  Cache Dependency   Key based One-to-one, one-to-many, and many-to-many   NCache Let cache manage relationships for you Cache invalidates related data when a cached item is updated/removed www.alachisoft.com 26
  27. 27. Alachisoft Synchronize Cache with Data Sources  Synchronize with Relational Databases (SQL, Oracle, etc.)     SqlDependency OracleDependency DbDependency Synchronize with non-Relational Data Sources   NCache File based Cache Dependency Custom Cache Dependency www.alachisoft.com 27
  28. 28. Alachisoft Data Grouping in the Cache  Group/Subgroup  Tags  Named Tags NCache www.alachisoft.com 28
  29. 29. Alachisoft Searching the Cache  Parallel Queries with Object Query Language (OQL)   Parallel LINQ Queries   SQL-like query language to search cache based on object attributes Standard LINQ queries can search the cache Indexing Object Attributes for Querying  NCache Create indexes on object attributes to speed up queries www.alachisoft.com 29
  30. 30. Alachisoft Read-thru, Write-thru, Write-behind  Read-through and write-through   Write-behind    You implement read-thru and write-thru handlers called by NCache Write-through has write-behind option that queues up database updates Database update queue replicated to multiple servers for reliability Reload Items on Expiration or Db Sync  NCache Use Read-thru to reload item from its data source instead of removing it www.alachisoft.com 30
  31. 31. Alachisoft Runtime Data Sharing with Messaging  Key Based Event Notifications     General Purpose Event Notifications   Register interest to be notified at ALL add/insert/remove (off by default) Custom Event Notifications    Register interest in specific cached items to be notified at insert/remove Register interest to be notified at ALL add/insert/remove (off by default) Send custom notifications to other NCache clients (cluster wide) Apps fire custom event notifications into NCache cluster Other apps are notified Continuous Queries Events   NCache SQL-Like query to specify dataset Event notifications fired when dataset changes in the cache cluster www.alachisoft.com 31
  32. 32. Alachisoft Some Other Features  NHibernate L2 Cache Provider   Entity Framework L2 Cache   Plug into NHibernate application without any code change Plug into Entity Framework application without any code change Dynamic Compact Serialization   NCache Faster and more compact then regular .NET serialization No code writing required www.alachisoft.com 32
  33. 33. Alachisoft What to Do Next?     Find more about NCache Download 60-day Trial Request a Personalized LIVE Demo Read product Documentation Thank You NCache 4.1 www.alachisoft.com 33

×