This document discusses caching for Java EE enterprise applications. It begins by explaining the need for caching to improve performance by reducing database access. It then describes advantages of caching like improved scalability and avoiding repeated object recreation. Potential disadvantages discussed are increased memory usage, synchronization complexity, and data durability issues. The document goes on to describe using HttpSession, EJB, and different caching algorithms like FIFO, LRU, and LFU for caching. It provides examples and diagrams to illustrate key caching concepts and components like CacheManager, CacheLoader, and CacheRegion.
This presentation mentions about key concepts of Java side caching and things to consider. It also mentions about popular tools and caching in AWS and Google App Engine.
A common request sent from your web browser to a web server goes quite a long way and it can take a great deal of time until the data your browser can display are fetched back. I will talk about making this great deal of time significantly less great by caching things on different levels, starting with client-side caching for faster display and minimizing transferred data, storing results of already performed operations and computations and finishing with lowering the load of database servers by caching result sets. Cache expiration and invalidation is the hardest part so I will cover that too. Presentation will be focused mainly on PHP, but most of the principles are quite general work elsewhere too.
This presentation mentions about key concepts of Java side caching and things to consider. It also mentions about popular tools and caching in AWS and Google App Engine.
A common request sent from your web browser to a web server goes quite a long way and it can take a great deal of time until the data your browser can display are fetched back. I will talk about making this great deal of time significantly less great by caching things on different levels, starting with client-side caching for faster display and minimizing transferred data, storing results of already performed operations and computations and finishing with lowering the load of database servers by caching result sets. Cache expiration and invalidation is the hardest part so I will cover that too. Presentation will be focused mainly on PHP, but most of the principles are quite general work elsewhere too.
This presentation provides a comparison of types of caches highlighting the use of distributed caching. This is followed by an introduction to JCache API. Code samples are at [2].
This is the presentation I did at Java Colombo JUG. [2]
[1] https://github.com/kasunbg/jcache-samples
[2] http://www.meetup.com/java-colombo/events/223811796/
Presented at JavaOne 2015.
JSR107, aka the Temporary Caching API for the Java Platform, has now been finalized almost 2 years ago. We've heard all about its ease of use and capabilities. But there is much left unaddressed. The good news is that the EG is looking at addressing many of the current shortcomings... But what do you do now? Go for proprietary APIs?!
Ehcache, the de facto caching API for 10 years now, has gone through a major API revamp: Ehcache3. One major theme, beyond its usual ease of use, was JSR107. Natively integrating it, but also looking beyond. With close to no API tie-ins, Ehcache3 lets you extend the JSR107 API transparently to go beyond the specification: topology-wise: whether you want to go offheap and scale up, or scale out by clustering your caches; functionality-wise: using transactional caches, automatic resource control or even using a write-behind cache to scale out writes...
Best of all is that this isn't only minimally intrusive, it is also all free to use and available as part of the open-source Ehcache v3 that has been GA'ed earlier this year...
We all love Ehcache. But the rise of real-time Big Data means you want to keep larger amounts of data in memory with low, predictable latency. In this webinar,
we explain how BigMemory Go can turbocharge your Ehcache deployment.
Do you need to scale your application, share data across cluster, perform massive parallel processing on many JVMs or maybe consider alternative to your favorite NoSQL technology? Hazelcast to the rescue! With Hazelcast distributed development is much easier. This presentation will be useful to those who would like to get acquainted with Hazelcast top features and see some of them in action, e.g. how to cluster application, cache data in it, partition in-memory data, distribute workload onto many servers, take advantage of parallel processing, etc.
Presented on JavaDay Kyiv 2014 conference.
Coming with different approach, this slide will explain How we can use Memcache as Session handler in PHP? This slide will also explain, How we can keep session centralised and share it on LB? Considering that you are using linux, the commands given in slides are linux commands.
[Hanoi-August 13] Tech Talk on Caching SolutionsITviec
ITviec Tech Talk
Hanoi, 24 August 2013
Topic: Caching Solutions
Speaker: Mr. Hoang Tran from Niteco
For full report of the talk: http://blog.itviec.com/2013/08/caching-solutions-response-time-niteco/
From distributed caches to in-memory data gridsMax Alexejev
A brief introduction into modern caching technologies, starting from distributed memcached to modern data grids like Oracle Coherence.
Slides were presented during distributed caching tech talk in Moscow, May 17 2012.
This presentation on "Getting Started with HazelCast" was made by Sandeep Kumar Pandey from Lastminute.com in Core Java / BoJUG meetup group on 24th March.
"In this session, we are going to talk about high level architecture of Hazelcast framework and we will look into the Java Collections and concepts which has been used to build the framework. We will also have a live demo on Distributed Cache using Hazelcast."
From cache to in-memory data grid. Introduction to Hazelcast.Taras Matyashovsky
This presentation:
* covers basics of caching and popular cache types
* explains evolution from simple cache to distributed, and from distributed to IMDG
* not describes usage of NoSQL solutions for caching
* is not intended for products comparison or for promotion of Hazelcast as the best solution
A brief overview of caching mechanisms in a web application. Taking a look at the different layers of caching and how to utilize them in a PHP code base. We also compare Redis and MemCached discussing their advantages and disadvantages.
This technical presentation shows you the best practices with EDB Postgres tools, that are designed to make database administration easier and more efficient:
● Tune a new database using Postgres Expert
● Set up streaming replication in EDB Postgres Enterprise Manager (PEM)
● Create a backup schedule in EDB Postgres Backup and Recovery
● Automatically failover with EDB Postgres Failover Manager
● Use SQL Profiler and Index Advisor to add indexes
The presentation also included a demonstration. To access the recording visit www.enterprisedb.com and access the webcast recordings section or email info@enterprisedb.com.
International Journal of Engineering Research and Development (IJERD)IJERD Editor
journal publishing, how to publish research paper, Call For research paper, international journal, publishing a paper, IJERD, journal of science and technology, how to get a research paper published, publishing a paper, publishing of journal, publishing of research paper, reserach and review articles, IJERD Journal, How to publish your research paper, publish research paper, open access engineering journal, Engineering journal, Mathemetics journal, Physics journal, Chemistry journal, Computer Engineering, Computer Science journal, how to submit your paper, peer reviw journal, indexed journal, reserach and review articles, engineering journal, www.ijerd.com, research journals,
yahoo journals, bing journals, International Journal of Engineering Research and Development, google journals, hard copy of journal
This presentation provides a comparison of types of caches highlighting the use of distributed caching. This is followed by an introduction to JCache API. Code samples are at [2].
This is the presentation I did at Java Colombo JUG. [2]
[1] https://github.com/kasunbg/jcache-samples
[2] http://www.meetup.com/java-colombo/events/223811796/
Presented at JavaOne 2015.
JSR107, aka the Temporary Caching API for the Java Platform, has now been finalized almost 2 years ago. We've heard all about its ease of use and capabilities. But there is much left unaddressed. The good news is that the EG is looking at addressing many of the current shortcomings... But what do you do now? Go for proprietary APIs?!
Ehcache, the de facto caching API for 10 years now, has gone through a major API revamp: Ehcache3. One major theme, beyond its usual ease of use, was JSR107. Natively integrating it, but also looking beyond. With close to no API tie-ins, Ehcache3 lets you extend the JSR107 API transparently to go beyond the specification: topology-wise: whether you want to go offheap and scale up, or scale out by clustering your caches; functionality-wise: using transactional caches, automatic resource control or even using a write-behind cache to scale out writes...
Best of all is that this isn't only minimally intrusive, it is also all free to use and available as part of the open-source Ehcache v3 that has been GA'ed earlier this year...
We all love Ehcache. But the rise of real-time Big Data means you want to keep larger amounts of data in memory with low, predictable latency. In this webinar,
we explain how BigMemory Go can turbocharge your Ehcache deployment.
Do you need to scale your application, share data across cluster, perform massive parallel processing on many JVMs or maybe consider alternative to your favorite NoSQL technology? Hazelcast to the rescue! With Hazelcast distributed development is much easier. This presentation will be useful to those who would like to get acquainted with Hazelcast top features and see some of them in action, e.g. how to cluster application, cache data in it, partition in-memory data, distribute workload onto many servers, take advantage of parallel processing, etc.
Presented on JavaDay Kyiv 2014 conference.
Coming with different approach, this slide will explain How we can use Memcache as Session handler in PHP? This slide will also explain, How we can keep session centralised and share it on LB? Considering that you are using linux, the commands given in slides are linux commands.
[Hanoi-August 13] Tech Talk on Caching SolutionsITviec
ITviec Tech Talk
Hanoi, 24 August 2013
Topic: Caching Solutions
Speaker: Mr. Hoang Tran from Niteco
For full report of the talk: http://blog.itviec.com/2013/08/caching-solutions-response-time-niteco/
From distributed caches to in-memory data gridsMax Alexejev
A brief introduction into modern caching technologies, starting from distributed memcached to modern data grids like Oracle Coherence.
Slides were presented during distributed caching tech talk in Moscow, May 17 2012.
This presentation on "Getting Started with HazelCast" was made by Sandeep Kumar Pandey from Lastminute.com in Core Java / BoJUG meetup group on 24th March.
"In this session, we are going to talk about high level architecture of Hazelcast framework and we will look into the Java Collections and concepts which has been used to build the framework. We will also have a live demo on Distributed Cache using Hazelcast."
From cache to in-memory data grid. Introduction to Hazelcast.Taras Matyashovsky
This presentation:
* covers basics of caching and popular cache types
* explains evolution from simple cache to distributed, and from distributed to IMDG
* not describes usage of NoSQL solutions for caching
* is not intended for products comparison or for promotion of Hazelcast as the best solution
A brief overview of caching mechanisms in a web application. Taking a look at the different layers of caching and how to utilize them in a PHP code base. We also compare Redis and MemCached discussing their advantages and disadvantages.
This technical presentation shows you the best practices with EDB Postgres tools, that are designed to make database administration easier and more efficient:
● Tune a new database using Postgres Expert
● Set up streaming replication in EDB Postgres Enterprise Manager (PEM)
● Create a backup schedule in EDB Postgres Backup and Recovery
● Automatically failover with EDB Postgres Failover Manager
● Use SQL Profiler and Index Advisor to add indexes
The presentation also included a demonstration. To access the recording visit www.enterprisedb.com and access the webcast recordings section or email info@enterprisedb.com.
International Journal of Engineering Research and Development (IJERD)IJERD Editor
journal publishing, how to publish research paper, Call For research paper, international journal, publishing a paper, IJERD, journal of science and technology, how to get a research paper published, publishing a paper, publishing of journal, publishing of research paper, reserach and review articles, IJERD Journal, How to publish your research paper, publish research paper, open access engineering journal, Engineering journal, Mathemetics journal, Physics journal, Chemistry journal, Computer Engineering, Computer Science journal, how to submit your paper, peer reviw journal, indexed journal, reserach and review articles, engineering journal, www.ijerd.com, research journals,
yahoo journals, bing journals, International Journal of Engineering Research and Development, google journals, hard copy of journal
In today’s systems , the time it takes to bring data to the end-user can be very long, especially under heavy load. An application can often increase performance by using an appropriate caching system. There are many caching level that you can use in our application today : CDN, In-Memory/Local Cache, Distributed Cache, Outut Cache, Browser Cache, Html Cache
A COMPARISON OF CACHE REPLACEMENT ALGORITHMS FOR VIDEO SERVICESijcsit
The increasing demand for video services has made video caching a necessity to decrease download times
and reduce Internet traffic. In addition, it is very important to store the right content at the right time in
caches to make effective use of caching. An informative decision has to be made as to which videos are to
be evicted from the cache in case of cache saturation. Therefore, the best cache replacement algorithm is
the algorithm which dynamically selects a suitable subset of videos for caching, and maximizes the cache
hit ratio by attempting to cache the videos which are most likely to be referenced in the future. In this paper
we study the most popular cache replacement algorithms (OPT, CC, QC, LRU-2, LRU, LFU and FIFO)
which are currently used in video caching. We use simulations to evaluate and compare these algorithms
using video popularities that follow a Zipf distribution. We consider different cache sizes and video request
rates. Our results show that the CC algorithm achieves the largest hit ratio and performs well even under
small cache sizes. On the other hand, the FIFO algorithm has the smallest hit ratio among all algorithms.
Optimizing your java applications for multi core hardwareIndicThreads
Session Presented at 5th IndicThreads.com Conference On Java held on 10-11 December 2010 in Pune, India
WEB: http://J10.IndicThreads.com
------------
Rising power dissipation in microprocessor chips is leading to a trend towards increasing the number of cores on a chip (multi-core processors) rather than increasing clock frequency as the primary basis for increasing system performance. Consequently the number of threads in commodity hardware has also exploded. This leads to complexity in designing and configuring high performance Java applications that make effective use of new hardware. In this talk we provide a summary of the changes happening in the multi-core world and subsequently discuss about some of the JVM features which exploit the multi-core capabilities of the underlying hardware. We also explain techniques to analyze and optimize your application for highly concurrent systems. Key topics include an overview of Java Virtual Machine features & configuration, ways to correctly leverage java.util.concurrent package to achieve enhanced parallelism for applications in a multi-core environment, operating system issues, virtualization, Java code optimizations and useful profiling tools and techniques.
Takeaways for the Audience
Attendees will leave with a better understanding of the new multi-core world, understanding of Java Virtual Machine features which exploit mulit-core and the techniques they can apply to ensure their Java applications run well in mulit-core environment.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
2. Caching – The Need
Web applications are typically accessed by many
concurrent users.
Usually, the application's data is stored in a
relational database or file system, and it takes
time and costs overhead to access these data
sources.
Database-access bottlenecks can slow down or
even crash the application if it receives too many
simultaneous requests.
Object caching is one technique that overcomes
this problem.
Caching is one of most important factors if we
think about application performance. Most
applications need a caching implementation to
improve performance.
3. Advantages
Caching is meant for High scalability and
performance
It reduces number of trips to the database
or other data sources, such as XML
databases or ERP (enterprise resource
planning) legacy systems
It avoids the cost of repeatedly recreating
objects
It shares objects between threads in a
process and between processes
It efficiently uses process resources
4. Disadvantages
Memory Size: The cache may consume significant
heap space in the application server. JVM
memory size can become unacceptably huge if a
lot of unused data is in the cache and not
released from memory at regular intervals.
Synchronization complexity: Depending on the
kind of data, complexity increases because
consistency between the cached data's state and
the data source's original data must be ensured.
Otherwise, the cached data can fall out of sync
with the actual data, which leads to data
inaccuracies.
Durability: Cache invalidation/deletion on server
crash
5. Caching by HttpSession
The HttpSession object (in the servlet
package) also allows objects to be cached,
but lacks the concepts of sharing,
invalidation, per-object expiration,
automatic loading, or spooling, which are
the essential elements of a caching
framework.
Also HttpSession object becomes quite
heavy, and are not meant to store huge
amount of data.
6. Caching by EJB
EJB provide a way to store an object
in memory and perform the object
lookup based on a key.
But none of these methods provide
any mechanism for either removing
the object from memory when it's no
longer needed or automatically
creating the object when it's
accessed after expiration
7. Caching Algorithms
Cache should be invalidated with
some algorithm if not needed as they
consume memory and got limited
capacity.
Few Examples: least frequently used
(LFU), least recently used (LRU),
most recently used (MRU), first in
first out (FIFO), last access time, and
object size.
8. 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.
Summary for FIFO: fast, not adaptive, not scan
resistant.
9. 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.
Cache access overhead is against 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 reaccessed 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 [4].
Summary for LRU: fast, adaptive, not scan resistant
10. LFU (Least Frequently Used)
Frequency of use data is kept on all items. The
most frequently used items are kept in the cache.
The advantage is that long term usage patterns
are captured well, incidentally making the
algorithm scan resistant as well; the
disadvantage, besides the larger access
overhead, is that the algorithm doesn’t adapt
quickly to changing usage patterns, and in
particular doesn’t help with temporally clustered
accesses.
Summary for LFU: not fast, captures frequency of
use, scan resistant
11. 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.
12. 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:00AM etc.
Summary for Extended time-based
expiration: Fast, not adaptive, not scan
resistant.
13. TTL (Time to live) 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 [5].
17. Main elements of an object-
caching framework
A typical caching framework contains
components such as
a CacheObject, CacheObjectKey, Cac
he, CacheManager, and a
CacheLoader.
18. ICacheManager
ICacheManager is the main interface (contract)
that a client program uses to handle all the
operations related to caching (i.e., storing,
accessing, and releasing the data in the cache).
The client program can be a JSP (JavaServer
Pages) page, a Struts action class or a POJO
(plain old Java object). This interface was created
to hide all the caching implementation details
from the client so if we needed to switch to a
different third-party caching API in the future, we
wouldn't need to change any of the client code.
19. BaseCacheManager
BaseCacheManager is the main class in the Web portal
caching framework. It's the base implementation
of ICacheManager. This class was created to centralize all
the cache-related methods in one class. It's designed as a
singleton to ensure one and only one instance
ofICacheManager is created in the servlet container's JVM.
In a clustered environment where multiple Web
server/servlet container instances accept Web requests, a
separate ICacheManager instance will be created in each
JVM. If we switch to a different caching API later, this is the
only class that must be modified to work with the new
cache API. Also, if we switch to a JCache-compliant caching
implementation, the cache manager should require minimal
changes.
20. ICacheLoader
The ICacheLoader interface implements the actual data-access logic in the
Web client. All client programs that need to use the caching mechanism
must implement this interface. It has one method
calledloadCacheObject() and takes two input parameters, a string to specify
the cache region name and an object to specify the cache key. This way,
the cache manager knows which client program to use (to
execute loadCacheObject()) to reload the object in the cache when the
cached data expires after the specified time-to-live has elapsed.
It is good practice for the caching service to load objects automatically as
needed rather than using the application to directly manage objects that
use the cache. When an application directly manages objects, it uses
the CacheAccess.put() method to insert objects into the cache. To take
advantage of automatic loading, we instead use a CacheLoader object and
implement its load method to put objects into the cache.
Note that the caching framework does not handle the creation of objects
that need to be cached in a Web application, i.e., the data-access logic that
retrieves the data from the data source is not coded in the caching classes.
It relies on the client program to define the actual data-access logic.
Technologies like Java Data Objects (JDO) are typically used to encapsulate
the data-access logic in an enterprise Web application.
21. ICacheKey
The ICacheKey interface was created to hide the
specific logic used to create a cache key.
Sometimes the cache key may not be a simple
string. It may be as complex as the combination
of multiple objects, and getting these values from
the data source involves not one, but several,
lookup methods. In this case, ICacheKey can
define all the complex logic involved in creating
the cache key. This way, the cache-key creation
logic is defined in a separate class. I wrote a
sample class called TestCacheKey that
implements this interface and overrides
the getCacheKey() method to illustrate how to
use this interface.
22. CacheRegion
A CacheRegion is defined as an
organizational namespace for holding a
collection of cache objects. Objects with
similar characteristics (such as time-to-live
and business use) should be cached in the
same cache region so they can all be
invalidated simultaneously if needed. To
eliminate any synchronization issues that
could cause poor performance, I used a
separate instance ofCache for each cache
region.
23. Cache Loader
In conjunction with eviction policies, a
cache loader allows a user to maintain a
bounded cache for a large backend
datastore. Frequently used data is fetched
from the datastore into the cache, and the
least used data is evicted, in order to
provide fast access to frequently accessed
data. With a cache loader, the Java object
cache automatically determines if an
object needs to be loaded into the cache
when the object is requested.
24. Locking
Two kinds of locking are normally adopted for
Java cache framework: pessimistic locking and
optimistically locking.
Pessimistic locking is an approach where an entity
is locked for the entire time during a transaction.
A lock either limits or prevents other users from
working with the entity.
Optimistic lock, which involved versioning data
and maintaining copies for each transaction,
validating copies upon transaction commit with
the cached entity. This approach led to a very
highly concurrent setup for a read-heavy system
where readers are never blocked by concurrent
writers, and also overcame the potential for
deadlocks which may occur in pessimistically
locked cache framework.
25. Different Caching Technologies
There are several:
Terracotta (open source, based on Mozilla Public License);
Oracle Coherence (formerly Tangosol Coherence;
commercial; based on JSR 107, which was never adopted
officially);
GigaSpaces (commercial; based on JavaSpaces API, part
of Jini);
GridGain, which you mentioned (open source: LGPL);
Memcached with a Java client library (open source:
BSD License;
EHCache (open source: Apache Software License;
OSCache (open source: modified Apache License; and
26. Grid Computing
Grid Computing is a way to distribute
your caching and computations
across multiple computers (nodes).
They are split them into 2
categories: Compute Grids and Data
Grids.
27. Compute Grid
Compute Grids allow you to take a computation, optionally
split it into multiple parts, and execute them on different
grid nodes in parallel. The obvious benefit here is that your
computation will perform faster as it now can use resources
from all grid nodes in parallel. One of the most common
design patterns for parallel execution is MapReduce.
However, Compute Grids are useful even if you don't need
to split your computation - they help you improve overall
scalability and fault-tolerance of your system by offloading
your computations onto most available nodes.
Some Compute Grid vendors:
- GridGain - Professional Open Source
- JPPF - Open Source
28. Data Grid
Data Grids allow you to distribute your data
across the grid. Most of us are used to the term
Distributed Cache rather than Data Grid (data
grid does sound more savvy though). The main
goal of Data Grid is to provide as much data as
possible from memory on every grid node and to
ensure data coherency.
Some Data Grid/Cache vendors:
- Oracle Coherence - Commercial
- GemStone - Commercial
- GigaSpaces - Commercial
- JBossCache - Professional Open Source
- EhCache - Open Source
29. Writing a Price to GigaSpaces
In “classic” JavaSpaces every object in the
space needsto implement “Entry”
–GigaSpaces have optimised this out in
their most recent release
// Find the
spaceJavaSpace space = (JavaSpace)SpaceFinder.find(“jini://*/*/
mySpace”);space.write( myPrice, null, Integer.MAX_VALUE ); //
null transactions
Because Sun haven’t evolved Jini and
JavaSpaces GigaSpaces (and others) have
had to do the innovation
30. Reading a Price from GigaSpaces
// Find the
spaceJavaSpace space = (JavaSpace)SpaceFinder.find(“jini://*/*/mySpace
”);// Define and template of what we’re looking for...Price template = new
Price ( “GBP/NOK”, “SPOT”, null );Object entry = space.read( template,
null, 10000 ); // null transactionsPrice myPrice = ((Price) entry);
Optimisations and exception handling were left out for
clarity e.g.
–We would normally use a “snapshot” of the template
Notice how the query is done by an interface/template
rather than adata-centric query
–This is more in line with SOA, i.e. Service Oriented as
opposed to data-oriented
So how does GigaSpaces work?
31.
32. Writing a Price to Coherence
We don’t need to implement anything
–Since the data is distributed is must of
course be Serializable
// Create / Find a cache (using the map interface)NamedCache
map = CacheFactory.getCache(“myCache");// Write the Price to
the cache... Map.put( trade.getKey(), trade );
Creating an index...
// Create an index on the “key” map.addIndex(new
ReflectionExtractor(“getKey”, false, null);
As you can see this couldn’t be easier
33. Reading a Price from Coherence
// Create / Find a cache (using the map interface) NamedCache
map = CacheFactory.getCache(“myCache");// Retrieve the
latest spot price for GBP/NOK Price myPrice =
(Price ) map.get(“GBP/NOK-SPOT” );
At this level Coherence works in a similar
way to GigaSpaces
34. References
http://java.dzone.com/articles/compute-grids-vs-data-grids
- Compute Grids vs. Data Grids
http://jasonwordpress.wordpress.com/2010/03/27/the-
strategies-of-using-java-caching-frameworks-to-increase-
the-performance-of-j2ee-applications/ - The strategies of
using Java caching frameworks
http://www.javaworld.com/javaworld/jw-05-
2004/jw-0531-cache.html - J2EE object-caching
frameworks - JavaWorld
http://www.scribd.com/doc/193625/Caching-Grid-In-A-
Nutshell - Caching Grid in a Nutshell