SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Caching in the Distributed Environment
                         Abhijit Gadkari




Based on the article published in the Microsoft Architecture Journal : Issue 17
Available on-line at http://www.msarchitecturejournal.com/pdf/Journal17.pdf
                                                                          1
http://msdn.microsoft.com/en-us/arcjournal/default.aspx
                                                          2
Agenda
Background info and basics

Different types of cache like temporal , spatial , primed and demand cache

Some Examples

Caching in the ORM world!

Transactional cache and Shared cache

Managing the interaction

Size of a cache and its impact on application performance

Five minute introduction of “Velocity” – Microsoft ‘s Distributed Caching
platform

Open Forum !
                                                                             3
Basics
          Storage Size                  Cost per byte
                           On Board
          Latency
                            RAM
                                                        Persistence

                          Hard Disk

                            Cloud


Data is stored in memory – i.e. L1, L2, L3 etc. known as cache. This
concept is extensively used in the von Neumann Architecture.

Memory Access time is measured in access time. Given an address ,
the memory presents the data at some other time

Memory Access Time = Latency + Transfer Size / Transfer Rate [2]
                                                                      4
Types of Data
                                        Data




                                        Activity                       Resource
     Reference
                                         Data                            Data
        Data




Understanding the different types of data and their semantics helps to understand the
different caching needs that comes with usage of that data type. [1]
                                                                                        5
Why ? – For Performance and Availability
Data Type [1]            Caching Strategy [1]
Reference Data           Practically immutable, non-volatile and long lasting in nature -
                         ideal candidate for caching. Can be shared across processes /
                         application. For example, zip code, state list, department list,
                         etc.
Activity Data            Activity data is generated by the currently executing activity as
                         part of a business transaction. Only good for the life on the
                         transaction. Short lived in nature. For example, shopping cart
                         on e-commerce web site.
Resource Data            Highly dependent on domain logic and volatile in nature. Cache
                         only when required. [a.k.a. don’t cache unless and until
                         absolutely required]. Commonly associated keywords –
                         concurrency , locking, ACID, dirty read, corrupt cache, business
                         logic, etc. For example, quantity information in an inventory
                         application.
Unknown                  DO NOT CACHE [ME]
“Keep a data item in electronic memory if its access frequency is five minutes or
higher, otherwise keep it in magnetic memory”[2]
Wikipedia defines cache as “a temporary area where frequently accessed data can
                  be stored for rapid access”[3]
                                                                                        6
Principle of Locality
Based on work done in 1959 on Atlas System’s
Virtual Memory [4]

Temporal Cache
Good for frequently accessed , relatively
nonvolatile data. For example, drop-down list on
a web page

Spatial Cache
Data adjacent to recently referenced data will be
requested in near future. For example, GridView
paging
                                               7
Temporal Cache




                      public sealed class Cache : IEnumerable
           using System.Web.Caching
                                                                8
Spatial Cache




        In .NET, cache can be synchronized using SqlCacheDependency
                                                                  9
Primed and Demand Cache [5,6]

Primed and Demand cache is based on the future use of the data.
Predating future is not easy and should be based on sound
engineering principals

The primed cache pattern is applicable when the cache or the part
of the cache can be predicted in advance. For example, a web
browser cache

The demand cache pattern is useful when cache can not be
predicted in advance. For example, a cached copy of user
credentials

The primed cache is populated at the beginning of the application,
whereas the demand cache is populated during the execution of
the application
                                                               10
Primed Cache




  In .NET ICachedReport interface can be used to store the
   pre-populated reports. The primed cache results in an almost
  constant size cache structure
                                                             11
Demand Cache



1 user can have many roles
1 role can have many permissions

Managing demand cache
Minimize memory leak
Maximize hit-ratio
Effective eviction policy

In dynamic environment
Adaptive Caching Strategies
can be very effective

                                   12
Caching in the ORM World!
                                                            Customer
                                         I
                                         M
cust_id    type      credit_allowed
                                         P
3456       gold      1                   E
                                         D
7890       bronze    0                   A
                                         N
                                         C
                                         E
                                         M
                                         I        Gold           Silver   Bronze
                                         S
                  RDBMS
                                         M
                                         A
                                         T
    RDBMS – persistent storage                    In memory object graph
                                         C
                                         H

                           Ms Entity Framework /LINQ
                           JDO, TopLink, Hibernate, NHibernate

The ORM manager populates the data stored in persistent storage
like database in the form of an object graph. An object graph is a
good caching candidate
                                                                             13
14
Layered Cache Architecture
                              The layering principle is based
                              on the explicit
                              Separation of responsibilities

                              Cache layering is prevalent in
                              many ORM solutions.
                              For Example, Velocity,
                              Hibernate

                              The first layer represents
                              the transactional cache and the
                              Second layer is the shared
                              cache designed as a process
                              or clustered cache

                                                          15
Transactional Cache

Objects formed in a valid state and participating in
a transaction can be stored in the transactional cache

Strictly bounded by the ACID rules

Transactional cache size is small size and short lived

Thrashing , cache corruption and caching conflicts should
be strictly avoided

 Many caching frameworks offer out of the box
prepackaged transactional cache solution
                                                          16
Shared Cache

Can be implemented as a process cache or clustered
cache. The clustered cache introduces resource replication
overhead

Shared cache is a read-only cache

Distributed caching solutions typically implements a
shared cache solution

Can be implemented as an identity map. For example,
caching read-only, static reports using ICachedReport

                                                        17
18
Chasing the Right Size Cache

Remember the 80-20 rule a.k.a. Pareto principle and the bell shaped
graph




                                                               19
Microsoft project code named Velocity [1]
http://msdn.microsoft.com/fi-fi/library/cc645013(en-us).aspx




Distributed in-memory application cache platform
 Can store any serializable CLR object
Allows clustering and provides ASP.NET session provider object so that ASP.NET session
objects can be stored in the distributed cache without having to write to database
                                                                                   20
Conventional Stack                   Stack with Distributed Cache


Application      Application              Application       Application


Web Server[s] / App Server[s]             Web Server[s] / App Server[s]


          Database                               Distributed Cache

                                 Application     Application
                                                    Database

                                      One Logical View

                 Velocity
                                   Physical
                                implementation
       Named Cache
                 Regions
                 Regions
       Named Cache
                                                                          21
                 Regions
Features [1]

Machine -> Cache Host -> Named Cache -> Regions -> Cache Items -> objects

Cache Operations
Get [select]– Returns object or entire Cache item
Add [insert]- Creates new entry else exception if entry exists
Put[update] - Replaces existing entry or creates a new one
Remove [delete]- Removes existing entry

Expiration and Eviction Policy is based on time-to-live [TTL] logic

Concurrency model supports optimistic version based updates and pessimistic
locking

“Velocity” can be deployed as a service or embedded within the application.
For example, host application can be ASP.NET / .NET application


                                                                         22
Example [1]
   // Create instance of cachefactory (reads appconfig)
   CacheFactory fac = new CacheFactory();

   // Get a named cache from the factory
   Cache catalog = fac.GetCache(quot;catalogcachequot;);

   // Simple Get/Put
   catalog.Put(quot;toy-101quot;, new Toy(quot;thomasquot;, .,.));

   // From the same or a different client
   Toy toyObj = (Toy)catalog.Get(quot;toy-101quot;);

   // Region based Get/Put
   catalog.CreateRegion(quot;toyRegionquot;);

   // Both toy and toyparts are put in the same region
   catalog.Put(quot;toyRegionquot;, quot;toy-101quot;, new Toy( .,.));
   Catalog.Put(quot;toyRegionquot;, quot;toypart-100quot;, new ToyParts(…));

   Toy toyObj = (Toy)catalog.Get(quot;toyRegionquot;, quot;toy-101quot;);
                                                            23
Resources
Based on the paper “Caching in the Distributed Environment”
published in the Microsoft Architecture Journal : Issue 17

1. Microsft Project Code Named “Velocity” by N. Sampathkumar, M
Krishnaprasad and A. Nori
2.Transaction Processing : Concepts and Techniques by Jim Gray and
Andreas Reuter [ISBN: 1558601902]
3. http://en.wikipedia.org/wiki/Cache
4. “The Locality Principle” by Peter J. Denning ,
Communications of the ACM”, July 2005, Vol 48, No 7
5. “Caching Patterns and Implementation”, by Octavian Paul Rotaru,
Leonardo Journal of Sciences LJS: 5:8 , January-June 2006
6. Data Access Patterns: Database Interactions in
Object-Oriented Applications, by Clifton Nock, Addision Wesley


                                                               24
Open Forum !

           Abhijit Gadkari
   Abhijit.Gadkari@gmail.com
Blog : http://soaas.blogspot.com/
                                    25

Más contenido relacionado

La actualidad más candente

File And Content Services
File And Content ServicesFile And Content Services
File And Content ServicesHunterFarmer
 
Introducing StorNext5 and Lattus
Introducing StorNext5 and LattusIntroducing StorNext5 and Lattus
Introducing StorNext5 and Lattusinside-BigData.com
 
Times Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo LudasTimes Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo LudasORACLE USER GROUP ESTONIA
 
Cache and consistency in nosql
Cache and consistency in nosqlCache and consistency in nosql
Cache and consistency in nosqlJoão Gabriel Lima
 
4 Ways To Save Big Money in Your Data Center and Private Cloud
4 Ways To Save Big Money in Your Data Center and Private Cloud4 Ways To Save Big Money in Your Data Center and Private Cloud
4 Ways To Save Big Money in Your Data Center and Private Cloudtervela
 
Digital Kniznica 09 Ben Osteen Oxford
Digital Kniznica 09 Ben Osteen OxfordDigital Kniznica 09 Ben Osteen Oxford
Digital Kniznica 09 Ben Osteen Oxfordguest045ab43
 
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012Marc Villemade
 
Gluster Blog 11.15.2010
Gluster Blog 11.15.2010Gluster Blog 11.15.2010
Gluster Blog 11.15.2010GlusterFS
 
Oracle Distributed Document Capture
Oracle Distributed Document CaptureOracle Distributed Document Capture
Oracle Distributed Document Captureguest035a27
 
Prepare Your Data For The Cloud
Prepare Your Data For The CloudPrepare Your Data For The Cloud
Prepare Your Data For The CloudIndicThreads
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0Karsten Dambekalns
 
VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11sriprasoon
 
The 25 Most Promising Open Source Projects
The 25 Most Promising Open Source ProjectsThe 25 Most Promising Open Source Projects
The 25 Most Promising Open Source Projectsaf83
 
ClearSky - Value to Manged Service Providers
ClearSky - Value to Manged Service Providers ClearSky - Value to Manged Service Providers
ClearSky - Value to Manged Service Providers rbcummings
 

La actualidad más candente (15)

File And Content Services
File And Content ServicesFile And Content Services
File And Content Services
 
635 642
635 642635 642
635 642
 
Introducing StorNext5 and Lattus
Introducing StorNext5 and LattusIntroducing StorNext5 and Lattus
Introducing StorNext5 and Lattus
 
Times Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo LudasTimes Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo Ludas
 
Cache and consistency in nosql
Cache and consistency in nosqlCache and consistency in nosql
Cache and consistency in nosql
 
4 Ways To Save Big Money in Your Data Center and Private Cloud
4 Ways To Save Big Money in Your Data Center and Private Cloud4 Ways To Save Big Money in Your Data Center and Private Cloud
4 Ways To Save Big Money in Your Data Center and Private Cloud
 
Digital Kniznica 09 Ben Osteen Oxford
Digital Kniznica 09 Ben Osteen OxfordDigital Kniznica 09 Ben Osteen Oxford
Digital Kniznica 09 Ben Osteen Oxford
 
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012
Panzura & Scality - Cloud Storage made seamless - Cloud Expo New York City 2012
 
Gluster Blog 11.15.2010
Gluster Blog 11.15.2010Gluster Blog 11.15.2010
Gluster Blog 11.15.2010
 
Oracle Distributed Document Capture
Oracle Distributed Document CaptureOracle Distributed Document Capture
Oracle Distributed Document Capture
 
Prepare Your Data For The Cloud
Prepare Your Data For The CloudPrepare Your Data For The Cloud
Prepare Your Data For The Cloud
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0
 
VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11
 
The 25 Most Promising Open Source Projects
The 25 Most Promising Open Source ProjectsThe 25 Most Promising Open Source Projects
The 25 Most Promising Open Source Projects
 
ClearSky - Value to Manged Service Providers
ClearSky - Value to Manged Service Providers ClearSky - Value to Manged Service Providers
ClearSky - Value to Manged Service Providers
 

Destacado

Mars Approaching
Mars ApproachingMars Approaching
Mars Approachinglps58
 
Blogstarz Presentation Ter Baru
Blogstarz Presentation Ter BaruBlogstarz Presentation Ter Baru
Blogstarz Presentation Ter Barumusslizz
 
Y5cafe introduction
Y5cafe introductionY5cafe introduction
Y5cafe introductionduongvilla
 
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間開放式概念發表平臺
 
Cryptography In Silverlight
Cryptography In SilverlightCryptography In Silverlight
Cryptography In SilverlightBarry Dorrans
 
Andreas .Key
Andreas .KeyAndreas .Key
Andreas .Keyplumum
 
Örjan Lönngren - Energianvändning kopplat till tillagning
Örjan Lönngren - Energianvändning kopplat till tillagningÖrjan Lönngren - Energianvändning kopplat till tillagning
Örjan Lönngren - Energianvändning kopplat till tillagningKlimatkommunerna
 
Hard Rain Kaj Embren (Respect) 14 april 2011
Hard Rain Kaj Embren (Respect) 14 april 2011Hard Rain Kaj Embren (Respect) 14 april 2011
Hard Rain Kaj Embren (Respect) 14 april 2011Klimatkommunerna
 
應用微機電感測科技開發未來智慧生活產品
應用微機電感測科技開發未來智慧生活產品應用微機電感測科技開發未來智慧生活產品
應用微機電感測科技開發未來智慧生活產品開放式概念發表平臺
 
Presentacion I Cities 2009
Presentacion I Cities 2009Presentacion I Cities 2009
Presentacion I Cities 2009Fernando Martin
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07Enthiosys Inc
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07Enthiosys Inc
 
01 necto introduction_ready
01 necto introduction_ready01 necto introduction_ready
01 necto introduction_readywww.panorama.com
 
What's New in NovaView 6.2
What's New in NovaView 6.2What's New in NovaView 6.2
What's New in NovaView 6.2www.panorama.com
 

Destacado (20)

Mars Approaching
Mars ApproachingMars Approaching
Mars Approaching
 
Akka (BeJUG)
Akka (BeJUG)Akka (BeJUG)
Akka (BeJUG)
 
Mlc The User Explained
Mlc The User ExplainedMlc The User Explained
Mlc The User Explained
 
Blogstarz Presentation Ter Baru
Blogstarz Presentation Ter BaruBlogstarz Presentation Ter Baru
Blogstarz Presentation Ter Baru
 
Cities: WordCamp Montreal 2013
Cities: WordCamp Montreal 2013Cities: WordCamp Montreal 2013
Cities: WordCamp Montreal 2013
 
Y5cafe introduction
Y5cafe introductionY5cafe introduction
Y5cafe introduction
 
MVC CSRF Protection
MVC CSRF ProtectionMVC CSRF Protection
MVC CSRF Protection
 
Webinar2
Webinar2Webinar2
Webinar2
 
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間
智慧生活科技的察覺與反思-營造舒適減壓的睡眠空間
 
Cryptography In Silverlight
Cryptography In SilverlightCryptography In Silverlight
Cryptography In Silverlight
 
Andreas .Key
Andreas .KeyAndreas .Key
Andreas .Key
 
Unenclosable
UnenclosableUnenclosable
Unenclosable
 
Örjan Lönngren - Energianvändning kopplat till tillagning
Örjan Lönngren - Energianvändning kopplat till tillagningÖrjan Lönngren - Energianvändning kopplat till tillagning
Örjan Lönngren - Energianvändning kopplat till tillagning
 
Hard Rain Kaj Embren (Respect) 14 april 2011
Hard Rain Kaj Embren (Respect) 14 april 2011Hard Rain Kaj Embren (Respect) 14 april 2011
Hard Rain Kaj Embren (Respect) 14 april 2011
 
應用微機電感測科技開發未來智慧生活產品
應用微機電感測科技開發未來智慧生活產品應用微機電感測科技開發未來智慧生活產品
應用微機電感測科技開發未來智慧生活產品
 
Presentacion I Cities 2009
Presentacion I Cities 2009Presentacion I Cities 2009
Presentacion I Cities 2009
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07
 
01 necto introduction_ready
01 necto introduction_ready01 necto introduction_ready
01 necto introduction_ready
 
What's New in NovaView 6.2
What's New in NovaView 6.2What's New in NovaView 6.2
What's New in NovaView 6.2
 

Similar a Caching in Distributed Environment

Beyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear ScalabilityBeyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear ScalabilityBen Stopford
 
Capacity Management for SAN
Capacity Management for SANCapacity Management for SAN
Capacity Management for SANMetron
 
As fast as a grid, as safe as a database
As fast as a grid, as safe as a databaseAs fast as a grid, as safe as a database
As fast as a grid, as safe as a databasegojkoadzic
 
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory Computing
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory ComputingIMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory Computing
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory ComputingIn-Memory Computing Summit
 
Choose the Right Container Storage for Kubernetes
Choose the Right Container Storage for KubernetesChoose the Right Container Storage for Kubernetes
Choose the Right Container Storage for KubernetesYusuf Hadiwinata Sutandar
 
Cncf storage-final-filip
Cncf storage-final-filipCncf storage-final-filip
Cncf storage-final-filipJuraj Hantak
 
Caching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaCaching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaShriKant Vashishtha
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionMarkus Michalewicz
 
AWS Well Architected-Info Session WeCloudData
AWS Well Architected-Info Session WeCloudDataAWS Well Architected-Info Session WeCloudData
AWS Well Architected-Info Session WeCloudDataWeCloudData
 
Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Mich Talebzadeh (Ph.D.)
 
Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Mich Talebzadeh (Ph.D.)
 
Open Stack Cheng Du Swift Alex Yang
Open Stack Cheng Du Swift Alex YangOpen Stack Cheng Du Swift Alex Yang
Open Stack Cheng Du Swift Alex YangOpenCity Community
 
Webinar: Unifying storage for EMC & NetApp
Webinar: Unifying storage for EMC & NetAppWebinar: Unifying storage for EMC & NetApp
Webinar: Unifying storage for EMC & NetAppJeannette Grand
 
Red Hat Storage: Emerging Use Cases
Red Hat Storage: Emerging Use CasesRed Hat Storage: Emerging Use Cases
Red Hat Storage: Emerging Use CasesRed_Hat_Storage
 
SNIA Cloud Storage Presentation
SNIA Cloud Storage PresentationSNIA Cloud Storage Presentation
SNIA Cloud Storage PresentationMark Carlson
 
Swift Architecture and Practice, by Alex Yang
Swift Architecture and Practice, by Alex YangSwift Architecture and Practice, by Alex Yang
Swift Architecture and Practice, by Alex YangHui Cheng
 
Inter connect2016 yss1841-cloud-storage-options-v4
Inter connect2016 yss1841-cloud-storage-options-v4Inter connect2016 yss1841-cloud-storage-options-v4
Inter connect2016 yss1841-cloud-storage-options-v4Tony Pearson
 
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?Storage Switzerland
 

Similar a Caching in Distributed Environment (20)

Beyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear ScalabilityBeyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
 
Capacity Management for SAN
Capacity Management for SANCapacity Management for SAN
Capacity Management for SAN
 
As fast as a grid, as safe as a database
As fast as a grid, as safe as a databaseAs fast as a grid, as safe as a database
As fast as a grid, as safe as a database
 
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory Computing
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory ComputingIMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory Computing
IMCSummit 2015 - Day 2 General Session - Flash-Extending In-Memory Computing
 
Choose the Right Container Storage for Kubernetes
Choose the Right Container Storage for KubernetesChoose the Right Container Storage for Kubernetes
Choose the Right Container Storage for Kubernetes
 
Cncf storage-final-filip
Cncf storage-final-filipCncf storage-final-filip
Cncf storage-final-filip
 
Caching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaCaching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant Vashishtha
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion Edition
 
AWS Well Architected-Info Session WeCloudData
AWS Well Architected-Info Session WeCloudDataAWS Well Architected-Info Session WeCloudData
AWS Well Architected-Info Session WeCloudData
 
Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...
 
Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...Real time processing of trade data with kafka, spark streaming and aerospike ...
Real time processing of trade data with kafka, spark streaming and aerospike ...
 
Open Stack Cheng Du Swift Alex Yang
Open Stack Cheng Du Swift Alex YangOpen Stack Cheng Du Swift Alex Yang
Open Stack Cheng Du Swift Alex Yang
 
Webinar: Unifying storage for EMC & NetApp
Webinar: Unifying storage for EMC & NetAppWebinar: Unifying storage for EMC & NetApp
Webinar: Unifying storage for EMC & NetApp
 
Red Hat Storage: Emerging Use Cases
Red Hat Storage: Emerging Use CasesRed Hat Storage: Emerging Use Cases
Red Hat Storage: Emerging Use Cases
 
SNIA Cloud Storage Presentation
SNIA Cloud Storage PresentationSNIA Cloud Storage Presentation
SNIA Cloud Storage Presentation
 
Open stackapac swift_alexyang
Open stackapac swift_alexyangOpen stackapac swift_alexyang
Open stackapac swift_alexyang
 
Swift Architecture and Practice, by Alex Yang
Swift Architecture and Practice, by Alex YangSwift Architecture and Practice, by Alex Yang
Swift Architecture and Practice, by Alex Yang
 
Ceph as software define storage
Ceph as software define storageCeph as software define storage
Ceph as software define storage
 
Inter connect2016 yss1841-cloud-storage-options-v4
Inter connect2016 yss1841-cloud-storage-options-v4Inter connect2016 yss1841-cloud-storage-options-v4
Inter connect2016 yss1841-cloud-storage-options-v4
 
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?
Webinar: Cloud Archiving – Amazon Glacier, Microsoft Azure or Something Else?
 

Último

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Último (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Caching in Distributed Environment

  • 1. Caching in the Distributed Environment Abhijit Gadkari Based on the article published in the Microsoft Architecture Journal : Issue 17 Available on-line at http://www.msarchitecturejournal.com/pdf/Journal17.pdf 1
  • 3. Agenda Background info and basics Different types of cache like temporal , spatial , primed and demand cache Some Examples Caching in the ORM world! Transactional cache and Shared cache Managing the interaction Size of a cache and its impact on application performance Five minute introduction of “Velocity” – Microsoft ‘s Distributed Caching platform Open Forum ! 3
  • 4. Basics Storage Size Cost per byte On Board Latency RAM Persistence Hard Disk Cloud Data is stored in memory – i.e. L1, L2, L3 etc. known as cache. This concept is extensively used in the von Neumann Architecture. Memory Access time is measured in access time. Given an address , the memory presents the data at some other time Memory Access Time = Latency + Transfer Size / Transfer Rate [2] 4
  • 5. Types of Data Data Activity Resource Reference Data Data Data Understanding the different types of data and their semantics helps to understand the different caching needs that comes with usage of that data type. [1] 5
  • 6. Why ? – For Performance and Availability Data Type [1] Caching Strategy [1] Reference Data Practically immutable, non-volatile and long lasting in nature - ideal candidate for caching. Can be shared across processes / application. For example, zip code, state list, department list, etc. Activity Data Activity data is generated by the currently executing activity as part of a business transaction. Only good for the life on the transaction. Short lived in nature. For example, shopping cart on e-commerce web site. Resource Data Highly dependent on domain logic and volatile in nature. Cache only when required. [a.k.a. don’t cache unless and until absolutely required]. Commonly associated keywords – concurrency , locking, ACID, dirty read, corrupt cache, business logic, etc. For example, quantity information in an inventory application. Unknown DO NOT CACHE [ME] “Keep a data item in electronic memory if its access frequency is five minutes or higher, otherwise keep it in magnetic memory”[2] Wikipedia defines cache as “a temporary area where frequently accessed data can be stored for rapid access”[3] 6
  • 7. Principle of Locality Based on work done in 1959 on Atlas System’s Virtual Memory [4] Temporal Cache Good for frequently accessed , relatively nonvolatile data. For example, drop-down list on a web page Spatial Cache Data adjacent to recently referenced data will be requested in near future. For example, GridView paging 7
  • 8. Temporal Cache public sealed class Cache : IEnumerable using System.Web.Caching 8
  • 9. Spatial Cache In .NET, cache can be synchronized using SqlCacheDependency 9
  • 10. Primed and Demand Cache [5,6] Primed and Demand cache is based on the future use of the data. Predating future is not easy and should be based on sound engineering principals The primed cache pattern is applicable when the cache or the part of the cache can be predicted in advance. For example, a web browser cache The demand cache pattern is useful when cache can not be predicted in advance. For example, a cached copy of user credentials The primed cache is populated at the beginning of the application, whereas the demand cache is populated during the execution of the application 10
  • 11. Primed Cache In .NET ICachedReport interface can be used to store the pre-populated reports. The primed cache results in an almost constant size cache structure 11
  • 12. Demand Cache 1 user can have many roles 1 role can have many permissions Managing demand cache Minimize memory leak Maximize hit-ratio Effective eviction policy In dynamic environment Adaptive Caching Strategies can be very effective 12
  • 13. Caching in the ORM World! Customer I M cust_id type credit_allowed P 3456 gold 1 E D 7890 bronze 0 A N C E M I Gold Silver Bronze S RDBMS M A T RDBMS – persistent storage In memory object graph C H Ms Entity Framework /LINQ JDO, TopLink, Hibernate, NHibernate The ORM manager populates the data stored in persistent storage like database in the form of an object graph. An object graph is a good caching candidate 13
  • 14. 14
  • 15. Layered Cache Architecture The layering principle is based on the explicit Separation of responsibilities Cache layering is prevalent in many ORM solutions. For Example, Velocity, Hibernate The first layer represents the transactional cache and the Second layer is the shared cache designed as a process or clustered cache 15
  • 16. Transactional Cache Objects formed in a valid state and participating in a transaction can be stored in the transactional cache Strictly bounded by the ACID rules Transactional cache size is small size and short lived Thrashing , cache corruption and caching conflicts should be strictly avoided  Many caching frameworks offer out of the box prepackaged transactional cache solution 16
  • 17. Shared Cache Can be implemented as a process cache or clustered cache. The clustered cache introduces resource replication overhead Shared cache is a read-only cache Distributed caching solutions typically implements a shared cache solution Can be implemented as an identity map. For example, caching read-only, static reports using ICachedReport 17
  • 18. 18
  • 19. Chasing the Right Size Cache Remember the 80-20 rule a.k.a. Pareto principle and the bell shaped graph 19
  • 20. Microsoft project code named Velocity [1] http://msdn.microsoft.com/fi-fi/library/cc645013(en-us).aspx Distributed in-memory application cache platform  Can store any serializable CLR object Allows clustering and provides ASP.NET session provider object so that ASP.NET session objects can be stored in the distributed cache without having to write to database 20
  • 21. Conventional Stack Stack with Distributed Cache Application Application Application Application Web Server[s] / App Server[s] Web Server[s] / App Server[s] Database Distributed Cache Application Application Database One Logical View Velocity Physical implementation Named Cache Regions Regions Named Cache 21 Regions
  • 22. Features [1] Machine -> Cache Host -> Named Cache -> Regions -> Cache Items -> objects Cache Operations Get [select]– Returns object or entire Cache item Add [insert]- Creates new entry else exception if entry exists Put[update] - Replaces existing entry or creates a new one Remove [delete]- Removes existing entry Expiration and Eviction Policy is based on time-to-live [TTL] logic Concurrency model supports optimistic version based updates and pessimistic locking “Velocity” can be deployed as a service or embedded within the application. For example, host application can be ASP.NET / .NET application 22
  • 23. Example [1] // Create instance of cachefactory (reads appconfig) CacheFactory fac = new CacheFactory(); // Get a named cache from the factory Cache catalog = fac.GetCache(quot;catalogcachequot;); // Simple Get/Put catalog.Put(quot;toy-101quot;, new Toy(quot;thomasquot;, .,.)); // From the same or a different client Toy toyObj = (Toy)catalog.Get(quot;toy-101quot;); // Region based Get/Put catalog.CreateRegion(quot;toyRegionquot;); // Both toy and toyparts are put in the same region catalog.Put(quot;toyRegionquot;, quot;toy-101quot;, new Toy( .,.)); Catalog.Put(quot;toyRegionquot;, quot;toypart-100quot;, new ToyParts(…)); Toy toyObj = (Toy)catalog.Get(quot;toyRegionquot;, quot;toy-101quot;); 23
  • 24. Resources Based on the paper “Caching in the Distributed Environment” published in the Microsoft Architecture Journal : Issue 17 1. Microsft Project Code Named “Velocity” by N. Sampathkumar, M Krishnaprasad and A. Nori 2.Transaction Processing : Concepts and Techniques by Jim Gray and Andreas Reuter [ISBN: 1558601902] 3. http://en.wikipedia.org/wiki/Cache 4. “The Locality Principle” by Peter J. Denning , Communications of the ACM”, July 2005, Vol 48, No 7 5. “Caching Patterns and Implementation”, by Octavian Paul Rotaru, Leonardo Journal of Sciences LJS: 5:8 , January-June 2006 6. Data Access Patterns: Database Interactions in Object-Oriented Applications, by Clifton Nock, Addision Wesley 24
  • 25. Open Forum ! Abhijit Gadkari Abhijit.Gadkari@gmail.com Blog : http://soaas.blogspot.com/ 25