SlideShare une entreprise Scribd logo
1  sur  39
Dennis van der Stelt

Velocity, distributed caching
Session Code: NE.13
Introduction
• Class-A
–
–
–
–

Kennisprovider
Microsoft development
Training / Coaching
www.class-a.nl

• Dennis van der Stelt
– Trainer / Coach
– Weblog at http://bloggingabout.net/blogs/dennis/
Agenda
•
•
•
•
•
•

Challenges for webfarms
What is Velocity?
Options in caching in Velocity
Velocity features
Caching strategies
Best practices
Challenges for webfarms

Web server A

Load balancer

Web server B

Web server C
Solution : sticky sessions

Web server A

Load balancer

1.
2.
3.
4.

Web server B

Uneven load balancing
Lost sessions
Single point of failure
Need to drain state
Web server C
Solution : Use DBMS

Web server A

Load balancer

Web server B

1. Doesn’t scale
2. Creates a performance bottleneck
3. Clustering is costly and fault
sensitive Web server C
What is Velocity?
What is Velocity?
• An explicit, distributed, in-memory application cache for
all kinds of data (CLR objects, XML, Binary data, etc.)
– Flows "memory" across machines into a unified cache

Clients can be spread
across machines or
processes

Unified Cache View

Clients Access the
Cache as if it was a
large single cache

Cache Layer
distributes data
across the various
cache nodes
Velocity in a webfarm

Web server A

Load balancer

Web server B

Web server C
Why Velocity?
* Share data across applications
No more sticky routing

* Peformance
Operation
Read 2k
MSDN Forums

Throughput

Latency

30,000 / sec

3 – 4 ms

Write 2k
18,000 / sec
5 Velocity Servers, 40GB Cache
98% of all calls to database come from cache
Result is from 60% load on SQL Server, down to 2%
* Scale out

3 ms

Operation

Throughput

Read 2k

1

30,000 / sec

Read 2k

2

58, 600 / sec

Read 2k

Velocity

Servers

3

85, 500 / sec
Key features of Velocity
• Caches any serializable CLR object
• Enterprise scale
– Up to hundreds of computers
– Dynamic scaling

• Runs as a service
• Automatic load balancing
Key features of Velocity
• Tight integration with ASP.NET
– Use as session store
– Cache application data

• Integration with administration and
monitoring tools as System Center, etc.
• Cache-aside architecture for version 1
• Support for multiple client languages
– PHP, C#, C++, etc.
Velocity installation
• Needed for installation
– .NET Framework 3.5
– Windows XP/Vista/Server (2003/2008)

• Firewall exceptions on port 22233-22235
• Configuration
– SQL Server
– Network share
single-point-of-failure?
10 concurrent connections?
Basic terminology in Velocity
•
•
•
•
•
•
•

Cache host
Cache cluster
Cluster configuration storage
Machine 1
Machine
Machine
Named cache
2Cache
2Cache
Cache
Cache
host A
host B
host C
host D
Region
Named cache : Product catalog
Named cache : ShoppingCart
Cache item
Tags
Region A
Working with Velocity
// Create instance of CacheFactory, which reads app.config
DataCacheFactory factory = new DataCacheFactory();

// Get a named cache from the factory
DataCache cache = factory.GetCache("default");
// Cache.Put(string key, object value)
cache.Add("SDC", new SDNConference());
// Cache.Get(string key);
var meeting = (SDNConference)cache.Get("SDC");
// Via indexers is also an option
cache["what"] = new Object();
Object o = cache["what"];
Types of cache

Partitioned

• Data partitioned across all nodes
• Used for scale & availability

Replicated

• Data replicated across all nodes
• Used for high availability
• All reads occur on primary host

Local

• Payload stays in object form
• No serialization
• No extra network hops
Partitioned cache
Application 2

Application 1
Put(“T5”, “D”)

Routing table

Cache1

Routing table

Primary Regions
T1, “A”

Routing table

Cache2

Routing table

Primary Regions

Cache3

Routing table

Primary Regions
T5, “D”
T3, “A”
Replicated cache (high availability)
Application 2

Application 1
Put(“T5”, “D”)

Get(“T5”)

Routing table

Cache1

Routing table

Primary Regions
T1, “A”

Routing table

Cache2

Routing table

Primary Regions

Cache3

Routing table

Primary Regions
T5, “D”
T3, “A”

Secondary Regions
T5, “D”

Secondary Regions
T3, “A”

Secondary Regions
T1, “A”
Cache clients
Simple client

Routing Client

• Has to request
where objects live

• Has knowledge of
where objects live
• Keeps in sync with
hosts
• Performance
benefits
• Extra network
communication

Local cache
• No pre-installed
host needed
• Your application is
the host
• Configurable
• Stored in
deserialized state!
Partitioned cache fronted by local cache
Put(T5, “D”)

Get(T5)

Velocity Client2

Velocity Client1
Local cache

Local cache

T5, “D”

Routing layer

T5, “D”

Routing layer

Cache1

Cache2

Cache3

Primary Regions

Primary Regions

Primary Regions

T1, “A”

T5, “D”
T3, “A”
Velocity features
Regions
// Without regions
cache.Put("MyKey", sdnConference);
// With regions
cache.CreateRegion("MyRegion", true);
cache.Put("MyKey", sdnConference, "MyRegion");

var result = (SDNConference)cache.Get("MyKey", "MyRegion");

• Regions don’t distribute
• But will replicate when high availability is on!
Tags
var starWarsTag = new DataCacheTag("StarWars");
var tags = new List<DataCacheTag>();
tags.Add(starWarsTag);
tags.Add(new DataCacheTag("Force"));
tags.Add(new DataCacheTag("Sith"));

cache.Add("MyKey", "A New Hope", tags, "StarWarsRegion");
var result =
cache.GetObjectsByTag(starWarsTag, "StarWarsRegion");

foreach (var item in result)
{
Console.WriteLine("{0} has value of {1}",
item.Key, item.Value);
}
Optimistic locking
DataCacheItemVersion versionWillChange;
DataCacheItemVersion versionWithError;
// First get the current version 2 times
cache.Get("MyKey", out versionWillChange);
cache.Get("MyKey", out versionWithError);

// We change the key, version hasn't changed in Velocity yet.
cache.Put("MyKey", "MyNewValue", versionWillChange);
// Version has changed with previous update, this will #fail
cache.Put("MyKey", "MyErrorValue", versionWithError);
Pessimistic locking
DataCacheLockHandle lockHandle = null;
DataCacheLockHandle secondLockHandle = null;
// Lock our object
cache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out
lockHandle);

// This will still work
string result = (string)cache.Get("MyKey");
// Try to lock for 2nd time -> #fail
cache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out
secondLockHandle);
// This will break the lock!!!
cache.Put("MyKey", "MyNewValue");
Notification callback
DataCacheOperation filter = DataCacheOperation.AddItem;
cache.AddItemLevelCallback("MyKey", filter, callback);
cache.AddRegionLevelCallback("Region", filter, callback);
cache.AddFailureNotificationCallback(failCallback);
cache.Add("MyKey", "MyInitialValue");
public static void callback (string myCacheName,
string myRegion, string myKey,
DataCacheItemVersion itemVersion,
DataCacheOperation OperationId,
DataCacheNotificationDescriptor nd)
{
//display some of the delegate parameters
Console.WriteLine("Region : " + myRegion);
Console.WriteLine("Key
: " + myKey);
}
Cluster configuration
<dataCacheClient deployment="routing">
<localCache
isEnabled="true"
sync="TTLBased"
objectCount="100000"
ttlValue="300" />

<clientNotification pollInterval="300" />
<!-- cache host(s) -->
<hosts>
<host
name="localhost"
cachePort="22233"
cacheHostName="DistributedCacheService"/>
</hosts>
</dataCacheClient>
ASP.NET Session integration
• SessionStoreProvider class
– Plugs into ASP.NET Session store
– Stores session state in Velocity

• Scale
– Session information available at all ASP.NET
Nodes

• High availability
– Session data is backed up on addditional
machines
– Resilient to machine or process failures
Performance
Achieving scale and performance
• Scale on data size
– More machines => more memory to cache

• Scale on cache throughput
– Throughput : Operations/sec from entire cache
– More machines : keys distributed across more
machines => better throughput

• Performance
– High performance by scaling out data and processing
– Increased memory
– Increased processing
• Workload distributed across multiple cache nodes
Achieving scale and performance

Server 2 Added
Throughput Increases
Latency Decreases
Until Server Saturation

Server 3 Added
Throughput Increases
Latency Decreases

Load

Single Server
Throughput Increases
with Increasing Load
Until Server Saturation

Throughput
Latency
Caching strategies
Velocity
• Is Velocity next-next-finish?
– Think about the consequences!
– From in-proc. cache to out-of-process cache
– Multiple network cards for higher bandwith
• Don’t disturb your normal web visitors
• Velocity can bring network card to its knees

– Computers are communicating data
• Can you transfer lots of data, allowed to do so?
• What about security?
Best practices
• Develop a caching strategy
– When and what to cache
– Selection of cache keys

• Create guidelines for caching
– Make sure developers live by the strategy
– Caching is hard to do right

• Code once, measure twice
Best practices
• Cache close to where you need the items
– Usually presentation or service layer

• Cache wisely
– Think about cache item lifetimes, eviction
– Don’t cache to get performance, but to
improve performance

• Define a key naming convention
– Avoid conflicts of cache entries
Velocity and the future
• Available mid 2009 (huh?)
• Velocity is cache provider in .NET 4.0
• Version 2
– Will be available in the cloud
– LINQ over Velocity
– Output caching provider
– Cache through
• Read through & Write behind

– Grid computing
Review
• Distributed cache is the future for
performance demanding enterprises
– Linkedin, Slashdot, Facebook, Flickr,
Wikipedia

• Velocity makes this possible
• A giant hashtable with performance,
scalability and failover.
Thank you for your attention
• Dennis van der Stelt
– Dennis@BloggingAbout.NET
– http://twitter.com/dvdstelt/
– http://bloggingabout.net/blogs/dennis/
Resources to more information can be found here, incl. this slidedeck.
Evaluation form
Vul je evaluatieformulier in en maak kans
op een van de prachtige prijzen!!
Fill out your evaluation form and win one of
the great prizes!!

Session Code: NE.13

Contenu connexe

Tendances

Scale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricScale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricChris Dufour
 
Building better Node.js applications on MariaDB
Building better Node.js applications on MariaDBBuilding better Node.js applications on MariaDB
Building better Node.js applications on MariaDBMariaDB plc
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEduardo Pelegri-Llopart
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionColdFusionConference
 
Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache Cassandrazznate
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierKellyn Pot'Vin-Gorman
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsAlex Snaps
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsJignesh Shah
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcacheChris Westin
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld
 
Memcached Code Camp 2009
Memcached Code Camp 2009Memcached Code Camp 2009
Memcached Code Camp 2009NorthScale
 
The Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsThe Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsRomain Jacotin
 
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...VMworld
 
Scott Schnoll - Exchange server 2013 high availability and site resilience
Scott Schnoll - Exchange server 2013 high availability and site resilienceScott Schnoll - Exchange server 2013 high availability and site resilience
Scott Schnoll - Exchange server 2013 high availability and site resilienceNordic Infrastructure Conference
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesDimas Prasetyo
 
Introduction to failover clustering with sql server
Introduction to failover clustering with sql serverIntroduction to failover clustering with sql server
Introduction to failover clustering with sql serverEduardo Castro
 

Tendances (20)

Memcached
MemcachedMemcached
Memcached
 
Scale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricScale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App Fabric
 
Building better Node.js applications on MariaDB
Building better Node.js applications on MariaDBBuilding better Node.js applications on MariaDB
Building better Node.js applications on MariaDB
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage Patterns
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
 
Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache Cassandra
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroids
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
5 Reasons to Upgrade Ehcache to BigMemory Go
5 Reasons to Upgrade Ehcache to BigMemory Go5 Reasons to Upgrade Ehcache to BigMemory Go
5 Reasons to Upgrade Ehcache to BigMemory Go
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
 
Memcached Code Camp 2009
Memcached Code Camp 2009Memcached Code Camp 2009
Memcached Code Camp 2009
 
The Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsThe Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systems
 
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...
VMworld 2013: vSphere Data Protection (VDP) Technical Deep Dive and Troublesh...
 
Scott Schnoll - Exchange server 2013 high availability and site resilience
Scott Schnoll - Exchange server 2013 high availability and site resilienceScott Schnoll - Exchange server 2013 high availability and site resilience
Scott Schnoll - Exchange server 2013 high availability and site resilience
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practices
 
Introduction to failover clustering with sql server
Introduction to failover clustering with sql serverIntroduction to failover clustering with sql server
Introduction to failover clustering with sql server
 

En vedette

LCA13: Web Server and Caching Technologies
LCA13: Web Server and Caching TechnologiesLCA13: Web Server and Caching Technologies
LCA13: Web Server and Caching TechnologiesLinaro
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsDebajani Mohanty
 
LAS16-200: SCMI - System Management and Control Interface
LAS16-200:  SCMI - System Management and Control InterfaceLAS16-200:  SCMI - System Management and Control Interface
LAS16-200: SCMI - System Management and Control InterfaceLinaro
 
LAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community UpdateLAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community UpdateLinaro
 
LAS16-400: Mini Conference 3 AOSP (Session 1)
LAS16-400: Mini Conference 3 AOSP (Session 1)LAS16-400: Mini Conference 3 AOSP (Session 1)
LAS16-400: Mini Conference 3 AOSP (Session 1)Linaro
 
Las16 309 - lua jit arm64 port - status
Las16 309 - lua jit arm64 port - statusLas16 309 - lua jit arm64 port - status
Las16 309 - lua jit arm64 port - statusLinaro
 

En vedette (6)

LCA13: Web Server and Caching Technologies
LCA13: Web Server and Caching TechnologiesLCA13: Web Server and Caching Technologies
LCA13: Web Server and Caching Technologies
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise Applications
 
LAS16-200: SCMI - System Management and Control Interface
LAS16-200:  SCMI - System Management and Control InterfaceLAS16-200:  SCMI - System Management and Control Interface
LAS16-200: SCMI - System Management and Control Interface
 
LAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community UpdateLAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community Update
 
LAS16-400: Mini Conference 3 AOSP (Session 1)
LAS16-400: Mini Conference 3 AOSP (Session 1)LAS16-400: Mini Conference 3 AOSP (Session 1)
LAS16-400: Mini Conference 3 AOSP (Session 1)
 
Las16 309 - lua jit arm64 port - status
Las16 309 - lua jit arm64 port - statusLas16 309 - lua jit arm64 port - status
Las16 309 - lua jit arm64 port - status
 

Similaire à AppFabric Velocity

More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)Michael Collier
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricWim Van den Broeck
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
More Cache for Less Cash
More Cache for Less CashMore Cache for Less Cash
More Cache for Less CashMichael Collier
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
VMworld 2013: Maximize Database Performance in Your Software-Defined Data Center
VMworld 2013: Maximize Database Performance in Your Software-Defined Data CenterVMworld 2013: Maximize Database Performance in Your Software-Defined Data Center
VMworld 2013: Maximize Database Performance in Your Software-Defined Data CenterVMworld
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...Amazon Web Services
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cacheMarc Cortinas Val
 
Turning object storage into vm storage
Turning object storage into vm storageTurning object storage into vm storage
Turning object storage into vm storagewim_provoost
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...LarryZaman
 
Get started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual MachineGet started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual MachineLai Yoong Seng
 
Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWS Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWS Tom Laszewski
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'Kyle Hailey
 
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...Docker, Inc.
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyJohn Giaconia
 

Similaire à AppFabric Velocity (20)

More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabric
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
More Cache for Less Cash
More Cache for Less CashMore Cache for Less Cash
More Cache for Less Cash
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
VMworld 2013: Maximize Database Performance in Your Software-Defined Data Center
VMworld 2013: Maximize Database Performance in Your Software-Defined Data CenterVMworld 2013: Maximize Database Performance in Your Software-Defined Data Center
VMworld 2013: Maximize Database Performance in Your Software-Defined Data Center
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cache
 
Azure appfabric caching intro and tips
Azure appfabric caching intro and tipsAzure appfabric caching intro and tips
Azure appfabric caching intro and tips
 
Turning object storage into vm storage
Turning object storage into vm storageTurning object storage into vm storage
Turning object storage into vm storage
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
 
Get started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual MachineGet started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual Machine
 
Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWS Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWS
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'
 
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and Redundancy
 

Plus de Dennis van der Stelt

Change your architecture during deployment
Change your architecture during deploymentChange your architecture during deployment
Change your architecture during deploymentDennis van der Stelt
 
Death of the batch job - NServiceBus Sagas
Death of the batch job - NServiceBus SagasDeath of the batch job - NServiceBus Sagas
Death of the batch job - NServiceBus SagasDennis van der Stelt
 
Building reliable applications with messaging
Building reliable applications with messagingBuilding reliable applications with messaging
Building reliable applications with messagingDennis van der Stelt
 
Duplicating data or replicating data in Micro Services
Duplicating data or replicating data in Micro ServicesDuplicating data or replicating data in Micro Services
Duplicating data or replicating data in Micro ServicesDennis van der Stelt
 
LIDNUG : Reliable applications with messaging
LIDNUG : Reliable applications with messagingLIDNUG : Reliable applications with messaging
LIDNUG : Reliable applications with messagingDennis van der Stelt
 

Plus de Dennis van der Stelt (18)

Change your architecture during deployment
Change your architecture during deploymentChange your architecture during deployment
Change your architecture during deployment
 
Dealing with eventual consistency
Dealing with eventual consistencyDealing with eventual consistency
Dealing with eventual consistency
 
Dealing with eventual consistency
Dealing with eventual consistencyDealing with eventual consistency
Dealing with eventual consistency
 
Death of the batch job
Death of the batch jobDeath of the batch job
Death of the batch job
 
Death of the batch job - NServiceBus Sagas
Death of the batch job - NServiceBus SagasDeath of the batch job - NServiceBus Sagas
Death of the batch job - NServiceBus Sagas
 
Distributed Systems Principles
Distributed Systems PrinciplesDistributed Systems Principles
Distributed Systems Principles
 
Building reliable applications with messaging
Building reliable applications with messagingBuilding reliable applications with messaging
Building reliable applications with messaging
 
Distributed Systems principles
Distributed Systems principlesDistributed Systems principles
Distributed Systems principles
 
Een andere kijk op Microservices
Een andere kijk op MicroservicesEen andere kijk op Microservices
Een andere kijk op Microservices
 
Duplicating data or replicating data in Micro Services
Duplicating data or replicating data in Micro ServicesDuplicating data or replicating data in Micro Services
Duplicating data or replicating data in Micro Services
 
LIDNUG : Reliable applications with messaging
LIDNUG : Reliable applications with messagingLIDNUG : Reliable applications with messaging
LIDNUG : Reliable applications with messaging
 
Distributed Systems Design
Distributed Systems DesignDistributed Systems Design
Distributed Systems Design
 
Silverlight & WCF RIA
Silverlight & WCF RIASilverlight & WCF RIA
Silverlight & WCF RIA
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
App fabric introduction
App fabric introductionApp fabric introduction
App fabric introduction
 
SOLID Principles part 2
SOLID Principles part 2SOLID Principles part 2
SOLID Principles part 2
 
SOLID Principles part 1
SOLID Principles part 1SOLID Principles part 1
SOLID Principles part 1
 

Dernier

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Dernier (20)

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

AppFabric Velocity

  • 1. Dennis van der Stelt Velocity, distributed caching Session Code: NE.13
  • 2. Introduction • Class-A – – – – Kennisprovider Microsoft development Training / Coaching www.class-a.nl • Dennis van der Stelt – Trainer / Coach – Weblog at http://bloggingabout.net/blogs/dennis/
  • 3. Agenda • • • • • • Challenges for webfarms What is Velocity? Options in caching in Velocity Velocity features Caching strategies Best practices
  • 4. Challenges for webfarms Web server A Load balancer Web server B Web server C
  • 5. Solution : sticky sessions Web server A Load balancer 1. 2. 3. 4. Web server B Uneven load balancing Lost sessions Single point of failure Need to drain state Web server C
  • 6. Solution : Use DBMS Web server A Load balancer Web server B 1. Doesn’t scale 2. Creates a performance bottleneck 3. Clustering is costly and fault sensitive Web server C
  • 8. What is Velocity? • An explicit, distributed, in-memory application cache for all kinds of data (CLR objects, XML, Binary data, etc.) – Flows "memory" across machines into a unified cache Clients can be spread across machines or processes Unified Cache View Clients Access the Cache as if it was a large single cache Cache Layer distributes data across the various cache nodes
  • 9. Velocity in a webfarm Web server A Load balancer Web server B Web server C
  • 10. Why Velocity? * Share data across applications No more sticky routing * Peformance Operation Read 2k MSDN Forums Throughput Latency 30,000 / sec 3 – 4 ms Write 2k 18,000 / sec 5 Velocity Servers, 40GB Cache 98% of all calls to database come from cache Result is from 60% load on SQL Server, down to 2% * Scale out 3 ms Operation Throughput Read 2k 1 30,000 / sec Read 2k 2 58, 600 / sec Read 2k Velocity Servers 3 85, 500 / sec
  • 11. Key features of Velocity • Caches any serializable CLR object • Enterprise scale – Up to hundreds of computers – Dynamic scaling • Runs as a service • Automatic load balancing
  • 12. Key features of Velocity • Tight integration with ASP.NET – Use as session store – Cache application data • Integration with administration and monitoring tools as System Center, etc. • Cache-aside architecture for version 1 • Support for multiple client languages – PHP, C#, C++, etc.
  • 13. Velocity installation • Needed for installation – .NET Framework 3.5 – Windows XP/Vista/Server (2003/2008) • Firewall exceptions on port 22233-22235 • Configuration – SQL Server – Network share single-point-of-failure? 10 concurrent connections?
  • 14. Basic terminology in Velocity • • • • • • • Cache host Cache cluster Cluster configuration storage Machine 1 Machine Machine Named cache 2Cache 2Cache Cache Cache host A host B host C host D Region Named cache : Product catalog Named cache : ShoppingCart Cache item Tags Region A
  • 15. Working with Velocity // Create instance of CacheFactory, which reads app.config DataCacheFactory factory = new DataCacheFactory(); // Get a named cache from the factory DataCache cache = factory.GetCache("default"); // Cache.Put(string key, object value) cache.Add("SDC", new SDNConference()); // Cache.Get(string key); var meeting = (SDNConference)cache.Get("SDC"); // Via indexers is also an option cache["what"] = new Object(); Object o = cache["what"];
  • 16. Types of cache Partitioned • Data partitioned across all nodes • Used for scale & availability Replicated • Data replicated across all nodes • Used for high availability • All reads occur on primary host Local • Payload stays in object form • No serialization • No extra network hops
  • 17. Partitioned cache Application 2 Application 1 Put(“T5”, “D”) Routing table Cache1 Routing table Primary Regions T1, “A” Routing table Cache2 Routing table Primary Regions Cache3 Routing table Primary Regions T5, “D” T3, “A”
  • 18. Replicated cache (high availability) Application 2 Application 1 Put(“T5”, “D”) Get(“T5”) Routing table Cache1 Routing table Primary Regions T1, “A” Routing table Cache2 Routing table Primary Regions Cache3 Routing table Primary Regions T5, “D” T3, “A” Secondary Regions T5, “D” Secondary Regions T3, “A” Secondary Regions T1, “A”
  • 19. Cache clients Simple client Routing Client • Has to request where objects live • Has knowledge of where objects live • Keeps in sync with hosts • Performance benefits • Extra network communication Local cache • No pre-installed host needed • Your application is the host • Configurable • Stored in deserialized state!
  • 20. Partitioned cache fronted by local cache Put(T5, “D”) Get(T5) Velocity Client2 Velocity Client1 Local cache Local cache T5, “D” Routing layer T5, “D” Routing layer Cache1 Cache2 Cache3 Primary Regions Primary Regions Primary Regions T1, “A” T5, “D” T3, “A”
  • 22. Regions // Without regions cache.Put("MyKey", sdnConference); // With regions cache.CreateRegion("MyRegion", true); cache.Put("MyKey", sdnConference, "MyRegion"); var result = (SDNConference)cache.Get("MyKey", "MyRegion"); • Regions don’t distribute • But will replicate when high availability is on!
  • 23. Tags var starWarsTag = new DataCacheTag("StarWars"); var tags = new List<DataCacheTag>(); tags.Add(starWarsTag); tags.Add(new DataCacheTag("Force")); tags.Add(new DataCacheTag("Sith")); cache.Add("MyKey", "A New Hope", tags, "StarWarsRegion"); var result = cache.GetObjectsByTag(starWarsTag, "StarWarsRegion"); foreach (var item in result) { Console.WriteLine("{0} has value of {1}", item.Key, item.Value); }
  • 24. Optimistic locking DataCacheItemVersion versionWillChange; DataCacheItemVersion versionWithError; // First get the current version 2 times cache.Get("MyKey", out versionWillChange); cache.Get("MyKey", out versionWithError); // We change the key, version hasn't changed in Velocity yet. cache.Put("MyKey", "MyNewValue", versionWillChange); // Version has changed with previous update, this will #fail cache.Put("MyKey", "MyErrorValue", versionWithError);
  • 25. Pessimistic locking DataCacheLockHandle lockHandle = null; DataCacheLockHandle secondLockHandle = null; // Lock our object cache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out lockHandle); // This will still work string result = (string)cache.Get("MyKey"); // Try to lock for 2nd time -> #fail cache.GetAndLock("MyKey", new TimeSpan(0, 0, 10), out secondLockHandle); // This will break the lock!!! cache.Put("MyKey", "MyNewValue");
  • 26. Notification callback DataCacheOperation filter = DataCacheOperation.AddItem; cache.AddItemLevelCallback("MyKey", filter, callback); cache.AddRegionLevelCallback("Region", filter, callback); cache.AddFailureNotificationCallback(failCallback); cache.Add("MyKey", "MyInitialValue"); public static void callback (string myCacheName, string myRegion, string myKey, DataCacheItemVersion itemVersion, DataCacheOperation OperationId, DataCacheNotificationDescriptor nd) { //display some of the delegate parameters Console.WriteLine("Region : " + myRegion); Console.WriteLine("Key : " + myKey); }
  • 27. Cluster configuration <dataCacheClient deployment="routing"> <localCache isEnabled="true" sync="TTLBased" objectCount="100000" ttlValue="300" /> <clientNotification pollInterval="300" /> <!-- cache host(s) --> <hosts> <host name="localhost" cachePort="22233" cacheHostName="DistributedCacheService"/> </hosts> </dataCacheClient>
  • 28. ASP.NET Session integration • SessionStoreProvider class – Plugs into ASP.NET Session store – Stores session state in Velocity • Scale – Session information available at all ASP.NET Nodes • High availability – Session data is backed up on addditional machines – Resilient to machine or process failures
  • 30. Achieving scale and performance • Scale on data size – More machines => more memory to cache • Scale on cache throughput – Throughput : Operations/sec from entire cache – More machines : keys distributed across more machines => better throughput • Performance – High performance by scaling out data and processing – Increased memory – Increased processing • Workload distributed across multiple cache nodes
  • 31. Achieving scale and performance Server 2 Added Throughput Increases Latency Decreases Until Server Saturation Server 3 Added Throughput Increases Latency Decreases Load Single Server Throughput Increases with Increasing Load Until Server Saturation Throughput Latency
  • 33. Velocity • Is Velocity next-next-finish? – Think about the consequences! – From in-proc. cache to out-of-process cache – Multiple network cards for higher bandwith • Don’t disturb your normal web visitors • Velocity can bring network card to its knees – Computers are communicating data • Can you transfer lots of data, allowed to do so? • What about security?
  • 34. Best practices • Develop a caching strategy – When and what to cache – Selection of cache keys • Create guidelines for caching – Make sure developers live by the strategy – Caching is hard to do right • Code once, measure twice
  • 35. Best practices • Cache close to where you need the items – Usually presentation or service layer • Cache wisely – Think about cache item lifetimes, eviction – Don’t cache to get performance, but to improve performance • Define a key naming convention – Avoid conflicts of cache entries
  • 36. Velocity and the future • Available mid 2009 (huh?) • Velocity is cache provider in .NET 4.0 • Version 2 – Will be available in the cloud – LINQ over Velocity – Output caching provider – Cache through • Read through & Write behind – Grid computing
  • 37. Review • Distributed cache is the future for performance demanding enterprises – Linkedin, Slashdot, Facebook, Flickr, Wikipedia • Velocity makes this possible • A giant hashtable with performance, scalability and failover.
  • 38. Thank you for your attention • Dennis van der Stelt – Dennis@BloggingAbout.NET – http://twitter.com/dvdstelt/ – http://bloggingabout.net/blogs/dennis/ Resources to more information can be found here, incl. this slidedeck.
  • 39. Evaluation form Vul je evaluatieformulier in en maak kans op een van de prachtige prijzen!! Fill out your evaluation form and win one of the great prizes!! Session Code: NE.13