SlideShare a Scribd company logo
1 of 24
Selecting The Right Cache
Framework
BEST CACHE FRAMEWORK FOR YOUR APPLICATION
@MOHAMMED FA ZULUDDIN
Topics
• Overview
• Types of Caches
• Caching Algorithms
• Cache Time Based Expiration Models
• Cache Frameworks
• Cache Drawbacks
• A cache is an amount of faster memory used to improve data access by
storing portions of a data set the whole of which is slower to access.
• On most computer disk access is very slow relative to the speed of the main
memory; to speed repeated accesses to files or disk blocks, most computers
cache recently accessed data from disk in main memory or some other form
of fast memory.
• Using caching technology across the multi-tier model can help reduce the
number of back-and-forth communications.
• It avoids the expensive re-acquisition of objects by not releasing the objects
immediately after their use and instead, the objects are stored in memory and
reused for any subsequent client requests.
• The cache also allows the higher throughput from the underlying resources.
Overview
Caching Architecture
Overview
Types of Caches
• Web Caching (Browser/Proxy/Gateway):
• Browser, Proxy, and Gateway caching work differently but have the same goal
to reduce overall network traffic and latency.
• Browser caching is controlled at the individual user level, where as, proxy and
gateway is on a much larger scale.
• Commonly the cached data could be DNS (Domain Name Server) data, used
to resolve domain names to the IP addresses and mail server records.
• The data type which changes infrequently is best cached for longer periods of
time by the Proxy and/or Gateway servers.
• Browser caching helps users quickly navigate pages they have recently visited.
This caching feature is free to take advantage of and is often overlooked by
most hosting companies and many developers.
Types of Caches
Web Caching (Browser/Proxy/Gateway):
Types of Caches
• Data Caching:
• Data caching is a very important tool when you have database driven
applications or CMS solutions. It’s best used for frequent calls to data that
does not change rapidly.
• Data caching will help your website or application to load faster and it gives
better experience to the users.
• It will avoiding extra trips to the DB to retrieve data sets even it is not
changed. It stores the data in local memory on the server which is the fastest
way to retrieve information on a web server.
• The database is the bottle neck for almost all web application, so the fewer
DB calls the better. Most DB solutions will also make an attempt to cache
frequently used queries in order to reduce turnaround time. For example, MS
SQL uses Execution Plans for Store Procedures and Queries to speed up the
process time.
Types of Caches
Data Caching:
Types of Caches
• Application/Output Caching:
• Most CMS have built in this cache mechanisms; however, many users don’t
understand them and simply ignore them.
• It’s best to understand what data cache options you have and to implement
them whenever possible.
• Application/Output caching can drastically reduce your website load time and
reduce server overhead.
• Different than Data Caching, which stores raw data sets.
• Application/Output Caching often utilizes server level caching techniques that
cache raw HTML.
• It can be per page of data, parts of a page (headers/footers) or module data,
but it is usually HTML markup.
Types of Caches
• Distributed Caching:
• Distributed Caching is for the big applications.
• Most high volume systems like Google, YouTube, Amazon and many others
use this technique.
• This approach allows the web servers to pull and store from distributed
server’s memory. Once implemented, it allow the web server to simply serve
pages and not have to worry about running out of memory.
• This allows the distributed cache to be made up of a cluster of cheaper
machines only serving up memory. Once the cluster is setup, you can add
new machine of memory at any time without disrupting your users.
• Ever notice how these large companies like Google can return results so
quickly when they have hundreds of thousands of simultaneous users? They
use Clustered Distributed Caching along with other techniques to infinitely
store the data in memory because memory retrieval is faster than file or DB
retrieval.
Types of Caches
Distributed Caching:
Caching Algorithms
• Some of the most popular and theoretically important algorithms are
FIFO, LRU, LFU, LRU2, 2Q.
• FIFO (First In First Out):
• Items are added to the cache as they are accessed, putting them in a queue
or buffer and not changing their location in the buffer; when the cache is full,
items are ejected in the order they were added.
• Cache access overhead is constant time regardless of the size of the cache.
• The advantage of this algorithm is that it's simple and fast; it can be
implemented using just an array and an index.
• The disadvantage is that it's not very smart; it doesn't make any effort to keep
more commonly used items in cache.
Caching Algorithms
• LRU - (Least Recently Used):
• Items are added to the cache as they are accessed; when the cache is full, the
least recently used item is ejected.
• This type of cache is typically implemented as a linked list, so that an item in
cache, when it is accessed again, can be moved back up to the head of the
queue; items are ejected from the tail of the queue. Cache access overhead is
again constant time.
• This algorithm is simple and fast, and it has a significant advantage over FIFO
in being able to adapt somewhat to the data access pattern; frequently used
items are less likely to be ejected from the cache.
• The main disadvantage is that it can still get filled up with items that are
unlikely to be re-accessed soon; in particular, it can become useless in the
face of scans over a larger number of items than fit in the cache. Nonetheless,
this is by far the most frequently used caching algorithm.
Caching Algorithms
• LRU2 - (Least Recently Used Twice):
• Items are added to the main cache the second time they are accessed; when
the cache is full, the item whose second most recent access is ejected.
• Because of the need to track the two most recent accesses, access overhead
increases logarithmically with cache size, which can be a disadvantage. In
addition, accesses have to be tracked for some items not yet in the cache.
• There may also be a second, smaller, time limited cache to capture temporally
clustered accesses, but the optimal size of this cache relative to the main
cache depends strongly on the data access pattern, so there's some tuning
effort involved.
• The advantage is that it adapts to changing data patterns, like LRU, and in
addition won't fill up from scanning accesses, since items aren't retained in the
main cache unless they've been accessed more than once.
Caching Algorithms
• 2Q - (Two Queues):
• Items are added to an LRU cache as they are accessed.
• If accessed again, they are moved to a second, larger, LRU cache. Items are
typically ejected so as to keep the first cache at about 1/3 the size of the
second.
• This algorithm attempts to provide the advantages of LRU2 while keeping
cache access overhead constant, rather than having it increase with cache
size. Published data seems to indicate that it largely succeeds.
• LFU - (Least Frequently Used):
• Frequency of use data is kept on all items.
• The most frequently used items are kept in the cache. Because of the
bookkeeping requirements, cache access overhead increases logarithmically
with cache size; in addition, data needs to be kept on all items whether or not
in the cache.
Cache Time Based Expiration Models
• Simple time-based expiration: Data in the cache is invalidated based on
absolute time periods. Items are added to the cache, and remains in the
cache for a specific amount of time.
Summary for Simple time-based expiration: Fast, not adaptive, not scan
resistant.
• Extended time-based expiration: Data in the cache is invalidated based on
relative time periods. Items are added to the cache, and remains in the
cache until they are invalidated at certain points in time, such as every five
minutes, each day at 12.00 etc.
Summary for Extended time-based expiration: Fast, not adaptive, not scan
resistant.
• Sliding time-based expiration: Data in the cache is invalidated by specifying
the amount of time the item is allowed to be idle in the cache after last
access time.
Summary for Sliding time-based expiration: Fast, adaptive, not scan.
Caching Time Based Expiration
• JBoss Cache:
• It can be used in a standalone, non-clustered environment, to cache
frequently accessed data in memory thereby removing data retrieval or
calculation bottlenecks while providing “enterprise” features such as JTA
compatibility, eviction and persistence.
• JBoss Cache is also a clustered cache, and can be used in a cluster to
replicate state providing a high degree of failover.
• JBoss Cache can – and often is – used outside of JBoss AS, in other Java
EE environments such as spring, Tomcat, Glassfish, BEA WebLogic, IBM
WebSphere, and even in standalone Java programs.
• JBoss Cache works out of the box with most popular transaction
managers, and even provides an API where custom transaction manager
lookups can be written.
Cache Frameworks
• OSCache:
• It can be used to cache both static and dynamic web pages.
• OSCache is also used by many projects Jofti, spring, Hibernate.
• OSCache is also used by many sites like The Server Side, JRoller, and Java
Lobby
• JCS(Java Caching System):
• It is used in java for server-side java applications.
• It is intended to speed up dynamic web applications by providing a
means to manage cached data of various dynamic natures.
• Like any caching system, the JCS is most useful for high read, low put
applications.
Cache Frameworks
• EhCache:
• It is used for general purpose caching, J2EE and light-weight containers
tuned for large size cache objects.
• EhCache Acts as a pluggable cache for Hibernate 2.1. With Small foot
print, Minimal dependencies, fully documented and Production tested.
• It is used in a lot of Java frameworks such as Alfresco, Cocoon, Hibernate,
and spring, JPOX, Jofti, Acegi, Kosmos, Tudu Lists and Lutece.
• EhCache is the default cache for Hibernate with EhCache you can serialize
both Serializable objects and Non-serializable.
• Non-serializable Objects can use all parts of EhCache except for Disk
Store and replication.
Cache Frameworks
• JCache:
• JCache Open Source is an effort to make an Open Source version of JSR-107
JCache.
• ShiftOne:
• ShiftOne Java Object Cache is a Java library that implements several strict
object caching policies, as well as a light framework for configuring cache
behavior.
• SwarmCache:
• SwarmCache is a simple but effective distributed cache. It uses IP multicast to
efficiently communicate with any number of hosts on a LAN.
• It is specifically designed for use by clustered, database-driven web
applications.
• SwarmCache uses Java Groups internally to manage the membership and
communications of its distributed cache.
Cache Frameworks
• WhirlyCache:
• Whirlycache is a fast, configurable in-memory object cache for Java.
• It can be used, for example, to speed up a website or an application by
caching objects that would otherwise have to be created by querying a
database or by another expensive procedure.
• Jofti:
• Jofti is a simple to use, high-performance object indexing and searching
solution for Objects in a Caching layer or storage structure that supports the
Map interface.
• The framework supports EHCache, JBossCache and OSCache and provides
for transparent addition, removal and updating of objects in its index as well
as simple to use query capabilities for searching.
• Features include type aware searching, configurable object property indexing,
indexing/searching by interfaces as well as support for Dynamic Proxies,
primitive attributes, Collections and Arrays.
Cache Frameworks
• cache4j:
• cache4j is a cache for Java objects with a simple API and fast implementation.
• It features in-memory caching, a design for a multi-threaded environment,
both synchronized and blocking implementations, a choice of eviction
algorithms (LFU, LRU, FIFO), and the choice of either hard or soft references
for object storage..
• Open Terracotta:
• Open Terracotta is Open Source Clustering for Java.
• It has the features to support HTTP Session Replication, Distributed Cache,
POJO Clustering, Application Coordination across cluster's JVMs (made using
code injection, so you don't need to modify your code).
Cache Drawbacks
• Stale data:
• This means that when you use cached content/data you are at risk of
presenting old data that's no longer relevant to the new situation.
• If you've cached a query of products, but in the mean time the product
manager has delete four products, the users will get listings to products that
don't exists.
• Overhead:
• The business logic you use to make sure your data is somewhere between
being fast and being stale, which lead to complexity, and complexity leads to
more code that you need to maintain and understand.
• You'll easily lose oversight of where data exists in the caching complex, at
what level, and how to fix the stale data if you get it.
THANKS

More Related Content

What's hot

Security Best Practices for your Postgres Deployment
Security Best Practices for your Postgres DeploymentSecurity Best Practices for your Postgres Deployment
Security Best Practices for your Postgres DeploymentPGConf APAC
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Jason Ragsdale
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalabilityJason Ragsdale
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with HazelcastEmrah Kocaman
 
From distributed caches to in-memory data grids
From distributed caches to in-memory data gridsFrom distributed caches to in-memory data grids
From distributed caches to in-memory data gridsMax Alexejev
 
Chicago Data Summit: Geo-based Content Processing Using HBase
Chicago Data Summit: Geo-based Content Processing Using HBaseChicago Data Summit: Geo-based Content Processing Using HBase
Chicago Data Summit: Geo-based Content Processing Using HBaseCloudera, Inc.
 
Brief of Caching - Rafiul Islam
Brief of Caching - Rafiul IslamBrief of Caching - Rafiul Islam
Brief of Caching - Rafiul IslamCefalo
 
Writing Scalable Software in Java
Writing Scalable Software in JavaWriting Scalable Software in Java
Writing Scalable Software in JavaRuben Badaró
 
Thug feb 23 2015 Chen Zhang
Thug feb 23 2015 Chen ZhangThug feb 23 2015 Chen Zhang
Thug feb 23 2015 Chen ZhangChen Zhang
 
HBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBaseCon
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool ManagementBIOVIA
 
Optimizing Proxy Server Performance
Optimizing Proxy Server PerformanceOptimizing Proxy Server Performance
Optimizing Proxy Server PerformanceGeorge Coutsoumbidis
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...Ashnikbiz
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?Anton Zadorozhniy
 

What's hot (20)

Security Best Practices for your Postgres Deployment
Security Best Practices for your Postgres DeploymentSecurity Best Practices for your Postgres Deployment
Security Best Practices for your Postgres Deployment
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalability
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with Hazelcast
 
From distributed caches to in-memory data grids
From distributed caches to in-memory data gridsFrom distributed caches to in-memory data grids
From distributed caches to in-memory data grids
 
Chicago Data Summit: Geo-based Content Processing Using HBase
Chicago Data Summit: Geo-based Content Processing Using HBaseChicago Data Summit: Geo-based Content Processing Using HBase
Chicago Data Summit: Geo-based Content Processing Using HBase
 
Brief of Caching - Rafiul Islam
Brief of Caching - Rafiul IslamBrief of Caching - Rafiul Islam
Brief of Caching - Rafiul Islam
 
Brief of Caching
Brief of CachingBrief of Caching
Brief of Caching
 
Writing Scalable Software in Java
Writing Scalable Software in JavaWriting Scalable Software in Java
Writing Scalable Software in Java
 
Thug feb 23 2015 Chen Zhang
Thug feb 23 2015 Chen ZhangThug feb 23 2015 Chen Zhang
Thug feb 23 2015 Chen Zhang
 
HBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBase: Where Online Meets Low Latency
HBase: Where Online Meets Low Latency
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management
 
Java script framework
Java script frameworkJava script framework
Java script framework
 
Optimizing Proxy Server Performance
Optimizing Proxy Server PerformanceOptimizing Proxy Server Performance
Optimizing Proxy Server Performance
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Ispn
IspnIspn
Ispn
 
JCache Using JCache
JCache Using JCacheJCache Using JCache
JCache Using JCache
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?
 
Rails on HBase
Rails on HBaseRails on HBase
Rails on HBase
 

Viewers also liked

Scaling Your Microservices With LoopBack
Scaling Your Microservices With LoopBackScaling Your Microservices With LoopBack
Scaling Your Microservices With LoopBackRitchie Martori
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 
Building large scale, job processing systems with Scala Akka Actor framework
Building large scale, job processing systems with Scala Akka Actor frameworkBuilding large scale, job processing systems with Scala Akka Actor framework
Building large scale, job processing systems with Scala Akka Actor frameworkVignesh Sukumar
 
Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Kevin Buckley
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.usjclingan
 
Java EE Microservices
Java EE MicroservicesJava EE Microservices
Java EE Microservicesjclingan
 
Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Fabrice Sznajderman
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureMarcin Grzejszczak
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine LearningNVISIA
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using HazelcastTaras Matyashovsky
 
Apache Spark An Overview
Apache Spark An OverviewApache Spark An Overview
Apache Spark An OverviewMohit Jain
 
Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice frameworkFabrice Sznajderman
 

Viewers also liked (20)

Scaling Your Microservices With LoopBack
Scaling Your Microservices With LoopBackScaling Your Microservices With LoopBack
Scaling Your Microservices With LoopBack
 
Java workflow engines
Java workflow enginesJava workflow engines
Java workflow engines
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 
Building large scale, job processing systems with Scala Akka Actor framework
Building large scale, job processing systems with Scala Akka Actor frameworkBuilding large scale, job processing systems with Scala Akka Actor framework
Building large scale, job processing systems with Scala Akka Actor framework
 
Caching in
Caching inCaching in
Caching in
 
Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.us
 
Java EE Microservices
Java EE MicroservicesJava EE Microservices
Java EE Microservices
 
Cloud Security
Cloud Security Cloud Security
Cloud Security
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016)
 
NOSQL vs SQL
NOSQL vs SQLNOSQL vs SQL
NOSQL vs SQL
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice Architecture
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine Learning
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using Hazelcast
 
Apache Spark An Overview
Apache Spark An OverviewApache Spark An Overview
Apache Spark An Overview
 
Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice framework
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 

Similar to Choosing the Right Cache Framework

[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching SolutionsITviec
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.Taras Matyashovsky
 
Overview of the ehcache
Overview of the ehcacheOverview of the ehcache
Overview of the ehcacheHyeonSeok Choi
 
Training Webinar: Enterprise application performance with distributed caching
Training Webinar: Enterprise application performance with distributed cachingTraining Webinar: Enterprise application performance with distributed caching
Training Webinar: Enterprise application performance with distributed cachingOutSystems
 
A Closer Look at Apache Kudu
A Closer Look at Apache KuduA Closer Look at Apache Kudu
A Closer Look at Apache KuduAndriy Zabavskyy
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache designRohail Butt
 
Scalability Considerations
Scalability ConsiderationsScalability Considerations
Scalability ConsiderationsNavid Malek
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalChapter Three
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxAmanuelmergia
 
Webinar: Faster Log Indexing with Fusion
Webinar: Faster Log Indexing with FusionWebinar: Faster Log Indexing with Fusion
Webinar: Faster Log Indexing with FusionLucidworks
 
Cache, Caching, Cache Memory Explained
Cache, Caching, Cache Memory ExplainedCache, Caching, Cache Memory Explained
Cache, Caching, Cache Memory ExplainedNemwos
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for allVSKAMCSPSGCT
 
Cloud computing UNIT 2.1 presentation in
Cloud computing UNIT 2.1 presentation inCloud computing UNIT 2.1 presentation in
Cloud computing UNIT 2.1 presentation inRahulBhole12
 
System design for video streaming service
System design for video streaming serviceSystem design for video streaming service
System design for video streaming serviceNirmik Kale
 
Day 7 - Make it Fast
Day 7 - Make it FastDay 7 - Make it Fast
Day 7 - Make it FastBarry Jones
 
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Alluxio, Inc.
 

Similar to Choosing the Right Cache Framework (20)

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
 
[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Cache Memory.pptx
Cache Memory.pptxCache Memory.pptx
Cache Memory.pptx
 
Overview of the ehcache
Overview of the ehcacheOverview of the ehcache
Overview of the ehcache
 
Training Webinar: Enterprise application performance with distributed caching
Training Webinar: Enterprise application performance with distributed cachingTraining Webinar: Enterprise application performance with distributed caching
Training Webinar: Enterprise application performance with distributed caching
 
A Closer Look at Apache Kudu
A Closer Look at Apache KuduA Closer Look at Apache Kudu
A Closer Look at Apache Kudu
 
UNIT IV.pptx
UNIT IV.pptxUNIT IV.pptx
UNIT IV.pptx
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache design
 
Scalability Considerations
Scalability ConsiderationsScalability Considerations
Scalability Considerations
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
Webinar: Faster Log Indexing with Fusion
Webinar: Faster Log Indexing with FusionWebinar: Faster Log Indexing with Fusion
Webinar: Faster Log Indexing with Fusion
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Cache, Caching, Cache Memory Explained
Cache, Caching, Cache Memory ExplainedCache, Caching, Cache Memory Explained
Cache, Caching, Cache Memory Explained
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
 
Cloud computing UNIT 2.1 presentation in
Cloud computing UNIT 2.1 presentation inCloud computing UNIT 2.1 presentation in
Cloud computing UNIT 2.1 presentation in
 
System design for video streaming service
System design for video streaming serviceSystem design for video streaming service
System design for video streaming service
 
Day 7 - Make it Fast
Day 7 - Make it FastDay 7 - Make it Fast
Day 7 - Make it Fast
 
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
 

More from Mohammed Fazuluddin

Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityMohammed Fazuluddin
 
Software architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideSoftware architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideMohammed Fazuluddin
 
Mule ESB - An Enterprise Service Bus
Mule ESB - An Enterprise Service BusMule ESB - An Enterprise Service Bus
Mule ESB - An Enterprise Service BusMohammed Fazuluddin
 
Docker - A Quick Introduction Guide
Docker - A Quick Introduction GuideDocker - A Quick Introduction Guide
Docker - A Quick Introduction GuideMohammed Fazuluddin
 
Cassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideCassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideMohammed Fazuluddin
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorialMohammed Fazuluddin
 
Cloud computing and data security
Cloud computing and data securityCloud computing and data security
Cloud computing and data securityMohammed Fazuluddin
 

More from Mohammed Fazuluddin (20)

DOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGNDOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGN
 
New Relic Basics
New Relic BasicsNew Relic Basics
New Relic Basics
 
Terraform Basics
Terraform BasicsTerraform Basics
Terraform Basics
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API Security
 
Software architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideSoftware architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding Guide
 
Mule ESB - An Enterprise Service Bus
Mule ESB - An Enterprise Service BusMule ESB - An Enterprise Service Bus
Mule ESB - An Enterprise Service Bus
 
Docker - A Quick Introduction Guide
Docker - A Quick Introduction GuideDocker - A Quick Introduction Guide
Docker - A Quick Introduction Guide
 
Cassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideCassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction Guide
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
Rest API Design Rules
Rest API Design RulesRest API Design Rules
Rest API Design Rules
 
Scrum process framework
Scrum process frameworkScrum process framework
Scrum process framework
 
DevOps and Tools
DevOps and ToolsDevOps and Tools
DevOps and Tools
 
UI architecture & designing
UI architecture & designingUI architecture & designing
UI architecture & designing
 
Data streaming fundamentals
Data streaming fundamentalsData streaming fundamentals
Data streaming fundamentals
 
Microservice's in detailed
Microservice's in detailedMicroservice's in detailed
Microservice's in detailed
 
Cloud computing and data security
Cloud computing and data securityCloud computing and data security
Cloud computing and data security
 
Java Security Framework's
Java Security Framework'sJava Security Framework's
Java Security Framework's
 
Security Design Concepts
Security Design ConceptsSecurity Design Concepts
Security Design Concepts
 
Software Design Concepts
Software Design ConceptsSoftware Design Concepts
Software Design Concepts
 
Choosing The Right ESB
Choosing The Right ESBChoosing The Right ESB
Choosing The Right ESB
 

Recently uploaded

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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Recently uploaded (20)

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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Choosing the Right Cache Framework

  • 1. Selecting The Right Cache Framework BEST CACHE FRAMEWORK FOR YOUR APPLICATION @MOHAMMED FA ZULUDDIN
  • 2. Topics • Overview • Types of Caches • Caching Algorithms • Cache Time Based Expiration Models • Cache Frameworks • Cache Drawbacks
  • 3. • A cache is an amount of faster memory used to improve data access by storing portions of a data set the whole of which is slower to access. • On most computer disk access is very slow relative to the speed of the main memory; to speed repeated accesses to files or disk blocks, most computers cache recently accessed data from disk in main memory or some other form of fast memory. • Using caching technology across the multi-tier model can help reduce the number of back-and-forth communications. • It avoids the expensive re-acquisition of objects by not releasing the objects immediately after their use and instead, the objects are stored in memory and reused for any subsequent client requests. • The cache also allows the higher throughput from the underlying resources. Overview
  • 5. Types of Caches • Web Caching (Browser/Proxy/Gateway): • Browser, Proxy, and Gateway caching work differently but have the same goal to reduce overall network traffic and latency. • Browser caching is controlled at the individual user level, where as, proxy and gateway is on a much larger scale. • Commonly the cached data could be DNS (Domain Name Server) data, used to resolve domain names to the IP addresses and mail server records. • The data type which changes infrequently is best cached for longer periods of time by the Proxy and/or Gateway servers. • Browser caching helps users quickly navigate pages they have recently visited. This caching feature is free to take advantage of and is often overlooked by most hosting companies and many developers.
  • 6. Types of Caches Web Caching (Browser/Proxy/Gateway):
  • 7. Types of Caches • Data Caching: • Data caching is a very important tool when you have database driven applications or CMS solutions. It’s best used for frequent calls to data that does not change rapidly. • Data caching will help your website or application to load faster and it gives better experience to the users. • It will avoiding extra trips to the DB to retrieve data sets even it is not changed. It stores the data in local memory on the server which is the fastest way to retrieve information on a web server. • The database is the bottle neck for almost all web application, so the fewer DB calls the better. Most DB solutions will also make an attempt to cache frequently used queries in order to reduce turnaround time. For example, MS SQL uses Execution Plans for Store Procedures and Queries to speed up the process time.
  • 9. Types of Caches • Application/Output Caching: • Most CMS have built in this cache mechanisms; however, many users don’t understand them and simply ignore them. • It’s best to understand what data cache options you have and to implement them whenever possible. • Application/Output caching can drastically reduce your website load time and reduce server overhead. • Different than Data Caching, which stores raw data sets. • Application/Output Caching often utilizes server level caching techniques that cache raw HTML. • It can be per page of data, parts of a page (headers/footers) or module data, but it is usually HTML markup.
  • 10. Types of Caches • Distributed Caching: • Distributed Caching is for the big applications. • Most high volume systems like Google, YouTube, Amazon and many others use this technique. • This approach allows the web servers to pull and store from distributed server’s memory. Once implemented, it allow the web server to simply serve pages and not have to worry about running out of memory. • This allows the distributed cache to be made up of a cluster of cheaper machines only serving up memory. Once the cluster is setup, you can add new machine of memory at any time without disrupting your users. • Ever notice how these large companies like Google can return results so quickly when they have hundreds of thousands of simultaneous users? They use Clustered Distributed Caching along with other techniques to infinitely store the data in memory because memory retrieval is faster than file or DB retrieval.
  • 12. Caching Algorithms • Some of the most popular and theoretically important algorithms are FIFO, LRU, LFU, LRU2, 2Q. • FIFO (First In First Out): • Items are added to the cache as they are accessed, putting them in a queue or buffer and not changing their location in the buffer; when the cache is full, items are ejected in the order they were added. • Cache access overhead is constant time regardless of the size of the cache. • The advantage of this algorithm is that it's simple and fast; it can be implemented using just an array and an index. • The disadvantage is that it's not very smart; it doesn't make any effort to keep more commonly used items in cache.
  • 13. Caching Algorithms • LRU - (Least Recently Used): • Items are added to the cache as they are accessed; when the cache is full, the least recently used item is ejected. • This type of cache is typically implemented as a linked list, so that an item in cache, when it is accessed again, can be moved back up to the head of the queue; items are ejected from the tail of the queue. Cache access overhead is again constant time. • This algorithm is simple and fast, and it has a significant advantage over FIFO in being able to adapt somewhat to the data access pattern; frequently used items are less likely to be ejected from the cache. • The main disadvantage is that it can still get filled up with items that are unlikely to be re-accessed soon; in particular, it can become useless in the face of scans over a larger number of items than fit in the cache. Nonetheless, this is by far the most frequently used caching algorithm.
  • 14. Caching Algorithms • LRU2 - (Least Recently Used Twice): • Items are added to the main cache the second time they are accessed; when the cache is full, the item whose second most recent access is ejected. • Because of the need to track the two most recent accesses, access overhead increases logarithmically with cache size, which can be a disadvantage. In addition, accesses have to be tracked for some items not yet in the cache. • There may also be a second, smaller, time limited cache to capture temporally clustered accesses, but the optimal size of this cache relative to the main cache depends strongly on the data access pattern, so there's some tuning effort involved. • The advantage is that it adapts to changing data patterns, like LRU, and in addition won't fill up from scanning accesses, since items aren't retained in the main cache unless they've been accessed more than once.
  • 15. Caching Algorithms • 2Q - (Two Queues): • Items are added to an LRU cache as they are accessed. • If accessed again, they are moved to a second, larger, LRU cache. Items are typically ejected so as to keep the first cache at about 1/3 the size of the second. • This algorithm attempts to provide the advantages of LRU2 while keeping cache access overhead constant, rather than having it increase with cache size. Published data seems to indicate that it largely succeeds. • LFU - (Least Frequently Used): • Frequency of use data is kept on all items. • The most frequently used items are kept in the cache. Because of the bookkeeping requirements, cache access overhead increases logarithmically with cache size; in addition, data needs to be kept on all items whether or not in the cache.
  • 16. Cache Time Based Expiration Models • Simple time-based expiration: Data in the cache is invalidated based on absolute time periods. Items are added to the cache, and remains in the cache for a specific amount of time. Summary for Simple time-based expiration: Fast, not adaptive, not scan resistant. • Extended time-based expiration: Data in the cache is invalidated based on relative time periods. Items are added to the cache, and remains in the cache until they are invalidated at certain points in time, such as every five minutes, each day at 12.00 etc. Summary for Extended time-based expiration: Fast, not adaptive, not scan resistant. • Sliding time-based expiration: Data in the cache is invalidated by specifying the amount of time the item is allowed to be idle in the cache after last access time. Summary for Sliding time-based expiration: Fast, adaptive, not scan.
  • 17. Caching Time Based Expiration • JBoss Cache: • It can be used in a standalone, non-clustered environment, to cache frequently accessed data in memory thereby removing data retrieval or calculation bottlenecks while providing “enterprise” features such as JTA compatibility, eviction and persistence. • JBoss Cache is also a clustered cache, and can be used in a cluster to replicate state providing a high degree of failover. • JBoss Cache can – and often is – used outside of JBoss AS, in other Java EE environments such as spring, Tomcat, Glassfish, BEA WebLogic, IBM WebSphere, and even in standalone Java programs. • JBoss Cache works out of the box with most popular transaction managers, and even provides an API where custom transaction manager lookups can be written.
  • 18. Cache Frameworks • OSCache: • It can be used to cache both static and dynamic web pages. • OSCache is also used by many projects Jofti, spring, Hibernate. • OSCache is also used by many sites like The Server Side, JRoller, and Java Lobby • JCS(Java Caching System): • It is used in java for server-side java applications. • It is intended to speed up dynamic web applications by providing a means to manage cached data of various dynamic natures. • Like any caching system, the JCS is most useful for high read, low put applications.
  • 19. Cache Frameworks • EhCache: • It is used for general purpose caching, J2EE and light-weight containers tuned for large size cache objects. • EhCache Acts as a pluggable cache for Hibernate 2.1. With Small foot print, Minimal dependencies, fully documented and Production tested. • It is used in a lot of Java frameworks such as Alfresco, Cocoon, Hibernate, and spring, JPOX, Jofti, Acegi, Kosmos, Tudu Lists and Lutece. • EhCache is the default cache for Hibernate with EhCache you can serialize both Serializable objects and Non-serializable. • Non-serializable Objects can use all parts of EhCache except for Disk Store and replication.
  • 20. Cache Frameworks • JCache: • JCache Open Source is an effort to make an Open Source version of JSR-107 JCache. • ShiftOne: • ShiftOne Java Object Cache is a Java library that implements several strict object caching policies, as well as a light framework for configuring cache behavior. • SwarmCache: • SwarmCache is a simple but effective distributed cache. It uses IP multicast to efficiently communicate with any number of hosts on a LAN. • It is specifically designed for use by clustered, database-driven web applications. • SwarmCache uses Java Groups internally to manage the membership and communications of its distributed cache.
  • 21. Cache Frameworks • WhirlyCache: • Whirlycache is a fast, configurable in-memory object cache for Java. • It can be used, for example, to speed up a website or an application by caching objects that would otherwise have to be created by querying a database or by another expensive procedure. • Jofti: • Jofti is a simple to use, high-performance object indexing and searching solution for Objects in a Caching layer or storage structure that supports the Map interface. • The framework supports EHCache, JBossCache and OSCache and provides for transparent addition, removal and updating of objects in its index as well as simple to use query capabilities for searching. • Features include type aware searching, configurable object property indexing, indexing/searching by interfaces as well as support for Dynamic Proxies, primitive attributes, Collections and Arrays.
  • 22. Cache Frameworks • cache4j: • cache4j is a cache for Java objects with a simple API and fast implementation. • It features in-memory caching, a design for a multi-threaded environment, both synchronized and blocking implementations, a choice of eviction algorithms (LFU, LRU, FIFO), and the choice of either hard or soft references for object storage.. • Open Terracotta: • Open Terracotta is Open Source Clustering for Java. • It has the features to support HTTP Session Replication, Distributed Cache, POJO Clustering, Application Coordination across cluster's JVMs (made using code injection, so you don't need to modify your code).
  • 23. Cache Drawbacks • Stale data: • This means that when you use cached content/data you are at risk of presenting old data that's no longer relevant to the new situation. • If you've cached a query of products, but in the mean time the product manager has delete four products, the users will get listings to products that don't exists. • Overhead: • The business logic you use to make sure your data is somewhere between being fast and being stale, which lead to complexity, and complexity leads to more code that you need to maintain and understand. • You'll easily lose oversight of where data exists in the caching complex, at what level, and how to fix the stale data if you get it.