ncache architecture

21
Distributed Cache for .NET Open Source Iqbal Khan Technology Evangelist www.alachisoft.com , @NCache Architecture 1 @NCache Architecture www.alachisoft.com

Upload: alachisoft

Post on 23-Jan-2018

93 views

Category:

Software


0 download

TRANSCRIPT

Distributed Cache for .NET

Open Source

Iqbal KhanTechnology Evangelist

www.alachisoft.com, @NCache

Architecture

1@NCache Architecture www.alachisoft.com

The Scalability Problem

Application Tier Scales Linearly

BUT

Data Storage is the Bottleneck(Relational Databases, Mainframe Data, etc.)

NoSQL Database Not Always the Answer

(often unable to use it)

2@NCache Architecture www.alachisoft.com

Linear Scalability of NCache

3

NoSQL Database

Any NoSQL DB

Relational DB

SQL Database

- Low cost servers

- Data replication

- Cluster wide updates

NCache Dynamic Cluster

Windows 2008/2012 (64-bit)

Linear Scalability

Memory & CPU pooled

100% Traffic

20% Traffic

Legacy Data

Mainframe

Web Apps (.NET & Java) Web Services (.NET & Java) Server Apps (.NET & Java)

@NCache Architecture www.alachisoft.com

NCache Scalability Numbers

50,000

72,000

96,000

120,000

144,000

32,000

48,000

64,000

80,000

96,000

-

20,000

40,000

60,000

80,000

100,000

120,000

140,000

160,000

2 3 4 5 6

Txns/Sec

Cache Servers

Read/Sec

Writes/Sec

4@NCache Architecture www.alachisoft.com

Common Uses of NCache

1. App Data Caching– Cache linearly scalable (database is not)

– Data exists in BOTH cache & database (permanent data)

2. ASP.NET & ASP.NET Core Caching– ASP.NET Session State storage (single-site & multi-site)

– ASP.NET View State cache (pre-MVC)

– ASP.NET Output Cache provider (ASP.NET Core Response Caching)

– Data exists ONLY in cache (transient data)

3. Runtime Data Sharing thru Events– Event driven data sharing in pub/sub model

– Event notifications & Continuous Query

– Data exists ONLY in cache (transient data)

5@NCache Architecture www.alachisoft.com

Self-Healing Dynamic Cluster

6@NCache Architecture www.alachisoft.com

High Availability (100% Uptime)Self-Healing Dynamic Cluster

Peer to Peer Architecture

No single point of failure

No master/slave or majority rule

Runtime Add/Remove Servers

Without stopping anything

Connection Failover Support

Between clients & servers

Within cache cluster

Dynamic Configuration

Cluster membership propagated Dynamic Cache Cluster

NCache Srv

Add

Server

At

Runtime

Remove

Server

At

Runtime

NCache Srv NCache Srv

Cache Clients (Web/App Servers)

Cluster

Membership

Info

Cache

Topology Info

7@NCache Architecture www.alachisoft.com

Caching Toplogies

8@NCache Architecture www.alachisoft.com

Caching TopologiesMirrored Cache (2-node active/passive)

Server 1 Server 2

Mirrored Cache

1 2

3 4

5 6

Active

1 2

3 4

5 6

Passive

(Backup)

Async Mirroring

Cache Clients (Web/App Servers)

• 2 Nodes (Active & Passive)

• Clients Connect to Active Node

• Active Node has Entire Cache

– Passive node has a copy

• Async Mirroring

– Passive node becomes active

• Auto Failover Support

– Passive node becomes active

– Client auto-connect to it

9@NCache Architecture www.alachisoft.com

Caching TopologiesReplicated Cache

• All Nodes are Active

– Can be more than 2

• Entire Cache on Each Node

– Multiple copies of cache

• Client Connects to One Node

– Auto load balance

– Manual node selection

• Synchronous Updates

– Sequence based algorithm

– Slower than async options

Server 1 Server 2

Replicated Cache

1 2

3 4

5 6

Active

Synchronous Updates

Cache Clients (Web/App Servers)

1 2

3 4

5 6

Active

10@NCache Architecture www.alachisoft.com

Caching TopologiesPartitioned Cache

Partitions & Distribution Map

Automatic division of cache into partitions

One partition per cache server

1000 buckets per cache cluster

Buckets distributed evenly

Clients Connect to ALL servers

For single-hop data access

Data Balancing

Moves buckets to other partitions

When partition is added or removed

When partition overloaded

11@NCache Architecture www.alachisoft.com

Server 1 Server 2

Partitioned CacheCache Clients (Web/App Servers)

21

Partition 1

43

Partition 2

Distribution

Map

Distribution

Map

Caching TopologiesPartition-Replica Cache

Replicas of Partitions

Created automatically

On a different server

Are passive (no client talks to replicas). Only partition talks to it.

Async Replication (default)

Async replication is BULK copy

Could lose some data

Sync Replication

Done as part of operation

Operation fails if replication fails

Data Balancing on Replicas Too

When done on Partitions Server 1

Partition-Replica CacheCache Clients (Web/App Servers)

21

Partition 1

43

Replica 2

Distribution

Map

Distribution

Map

Server 2

43

Partition 2

21

Replica 1

12@NCache Architecture www.alachisoft.com

Server 1

Partition-Replica CacheCache Clients (Web/App Servers)

21

Partition 1

43

Replica 2

Distribution

Map

Distribution

Map

Server 2

43

Partition 2

21

Replica 1

Server 1 Server 2

Partitioned CacheCache Clients (Web/App Servers)

21

Partition 1

43

Partition 2

Distribution

Map

Distribution

Map

Caching TopologiesPartitioned Cache & Partition-Replica Cache

13@NCache Architecture www.alachisoft.com

Caching TopologiesData Balancing on Adding/Removing a Server

Server 1

21

Partition 1

Replica 3

65

Server 3

65

Partition 3

Replica 2

43

Server 2

43

Partition 2

Replica 1

21

Partition-Replica CachePartition-Replica Cache

Server 1

21

Partition 1

43

Replica 2

Server 2

43

Partition 2

21

Replica 1

14@NCache Architecture www.alachisoft.com

Client Cache (Near Cache)

15@NCache Architecture www.alachisoft.com

Client Cache (Near Cache)

Local cache (close to your app)

InProc or OutProc

Sync with cache cluster

Auto sync

Optimistic & pessimistic sync

No code changes needed

Automatically intercepts cache calls

Use in read-intensive cases Dynamic Cache Cluster

Cache Clients (Web/App Servers)

Client Cache

. . .Client CacheClient Cache

SynchronizedSynchronized Synchronized

Cache ServrCache Servr Cache Servr

Client Cache

Any Caching Toplogy

16@NCache Architecture www.alachisoft.com

WAN Replication

(Multi Datacenter Support)

17@NCache Architecture www.alachisoft.com

WAN Replication of Cache

Active-Passive

Active-Active

18@NCache Architecture www.alachisoft.com

API Overview

19@NCache Architecture www.alachisoft.com

App Data Caching API

• Connect & Disconnect from the Cache• Cache cache = NCache.InitializeCache(“myDistributedCache”);

• cache.Dispose();

• Read from the Cache

• Employee employee = (Employee) cache.Get(“Employee:1000”);

• Employee employee = (Employee) cache[“Employee:1000”];

• bool isPresent = cache.Contains(“Employee:1000”);

• Add to the Cache• cache.Add(“Employee:1000”, employee);

• cache.Insert(“Employee:1000”, employee);

• cache[“Employee:1000”] = employee;

• Remove from the Cache• Employee employee = (Employee) cache.Remove(“Employee:1000”);

20@NCache Architecture www.alachisoft.com

Next Steps

• Download NCache (Fully Working 60-Day Trial)– http://www.alachisoft.com/download.html

• Download NCache Open Source (FREE)– http://www.alachisoft.com/download.html

• Schedule a Personalized Online DEMO– One hour long

– Get answers to your questions from our Solution Architects

21@NCache Architecture www.alachisoft.com