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.
2. Get/Access the resource or Data once, use
multiple times
Frequently used strategy to improve
performance
Approach is language independent
Architecture and Design decision.
Multiple options available at multiple layers
JUG-Chennai 2
4. Serializable Java Objects
Stored In-Memory or File based
Key – Value Pairs
Scale of the Application determines the
solution
JUG-Chennai 4
5. Static Data
◦ State List
◦ Countries List
Pseudo Static Data
◦ Catalog Data
◦ Exchange Rate
Context Specific Data
◦ User Profile Data
◦ Session Specific Data
◦ Data From external Systems
Different Needs, Different
Solutions
JUG-Chennai 5
Determining Factors
• TTL (Time to Live)
• Frequency of Access
• Frequency of Update
• Deployment Architecture
• Scalability of the systems
• Object Size
• Heap Memory Availability
9. Number of parallel sessions
Available Heap memory
Average Session Duration
Number of Global objects to be stored in
Cache
Number of transaction specific objects to be
stored in Cache
Size of objects to be stored in Cache
JUG-Chennai 9
11. Open Source/Free
EhCache
JCS
JBossCache
MemaCache
JUG-Chennai 11
Commercial/Properiatery Solutions
• TerraCotta BigMemorys
• IBM Dynacache(Shipped with Websphere)
• IBM Extreme Scale
12. Maximum Memory
Purge Strategy
Reload
Scheduled Cache Expiry
Algorithm for removing item from
Cache(LRU,FIFO),MRU,Last Access Time etc
Object size based cache Removal
JUG-Chennai 12
13. High performance Distributed memory object caching system
Memacache consists of two parts
◦ Memacache Server. Separate process running in same
machine as server or running in different machine
◦ Memacache Client. Used by Client applications. Langauage
specific client jars are available to work with Memacache
JUG-Chennai 13
15. Predominantly based on Memacache
Available with all major cloud providers
Provides easy scalability, recovery etc
JUG-Chennai 15
16. Based Upon Memache or
Redis
Cache clusters consists of
multiple cache nodes.
Configured from AWS
mgmt console or tools
Redis-
◦ A popular open-source
in-memory key-value
store that supports data
structures such as sorted
sets and lists.
◦ ElastiCache supports
Redis master / slave
replication which can be
used to achieve cross AZ
redundancy.
JUG-Chennai 16
17. Provides Two Types of Cache
◦ In-Context Cache
Available only for the duration of single HTTP Request
Data is present in memory
◦ Memacache
Default and Enabled for All applications
Faster than datastore, slower than In-context cache
By default, a nontransactional context caches all entities in
memcache.
Memcache does not support transactions
When DB is updated, it needs to be updated explicitly in
Memacache
JUG-Chennai 17