I had a lot of interest in this topic, so I decided to take notes during the meeting. Rob Brooks-Bilson covered a lot of data and I made bullet points as he spoke. He has since posted his slides online so you can see the slides that go with my notes. Please let me know if you have any questions.
More notes here:
- Lot of different areas to cache... multiple opportunities
- Multiple caching architectures
- In-Process (L1 Cache)
- Operates in the same process as application server
- Super fast
- Out of Process (L2 Cache)
- Add on Terracoda
- Much more scalable but slower than in-process
- Data/objects must be serialized/deserialized
- Non-deterministic (cache-aside)
- Look in the cache, if not there, hit the db
- most popular
- Deterministic (cache as sor)
- Always go to the cache
- All cache data is pre-populated
- Cache Eviction Algorithms
- Ehcache
- De facto cache for enterprise Java and ColdFusion
- Over 500K implementations
- Can be configured to run
- Local: In-process
- Replicated: in-process
- Distributed: In-process and Out of process
- Super fast for in-process
- No serializations required for objects written to memory
- Supports multiple expiration algoritms
- Coldfusion
- page fragment
- objects and data
- ORM
- 9.0.1 addedl more support
- Ehcache 2.0 added a lot more support
- Don't cache to disk unless you absolutely have to
- Consider using RAM based
- "Put as much in memory as you can, use disk for failover"
- Every ColdFusion application has two available caches by default
- cfcache - template based, fairly automatic
- object cache - put queries, objects, etc - 'cache anything'
- Default caches are bound to named applications (Application.cfc or Application.cfm)
- Caches are NOT tied to ColdFusion scopes
- Caches persist even if the bound application scope times out
- Additional user-defined caches can be defined
- ehcache.xml
- Tons of options to configure
- Can be set dynamically using cacheSetProperties() or set in the xml
- Get the cache properties using the cacheGetProperties()
- Ehcache vs Persistent Variable Scopes
- Why use Ehcache instead?
- Limit to session scope
- Ehcache advantages
- Performs well regardless of load
- Easily replicated/distributed
- Self-managing
- Comprehensive monitoring and statistics
- Search
- Big memory
- Performance is about the same
- Object Caching Considerations
- Carefully consider how you plan to use keys to avoid potential key collision
- No namespace, but simulate them using User_, Product_, Item_, etc.
- Or use multiple caches regions
- Objects (including queries) are stored by reference - BE CAREFUL! - Or you can turn it off
- Only serializable objects can be written to the disk cache
- Be careful using cacheGetAllIDs() - with millions of items, could be a problem
- Cache Replication
- Object, Template & Hibernate caches can be replicated
- Simple config
- Cache replications can be done via RMI, JMS, jGroups or Terracotta
- Replication can be synchronous or async
- Sync vs Async
- Async is fastest
- Potential for data inconsistency
- Upgrading to Newer versions of Ehcache or Terracotta
- Adobe won't support but shouldn't have any problems
- Ehcache upgrade is easy
- Terracotta takes a few more steps
- Using Ehcache with Terracotta
- Tiered Caching Architecture
- L1 in process, L2 out of process
- Enterprise Terracotta lets you scale out and setup terabytes
- 80/20 rule
- Terracotta has a great dashboard / dev tools
- Slides available afterwards - 20-30 more slides
- Ehcache Monitor
- Free for development, commercial license for production
- Monitor multiple cache servers from a single web console
- Two components, probe and server
- Simple config
- Stats are transmitted via XML over HTTP
- Cache Search
- Available starting in Ehcache 2.4.0
- Single node for open source
- Multi node requires Enterprise
- Support for simple and compound functions
- Provides search operators (think AND, EQ, GT, LE, NOT, OR)
- Very powerful - no ColdFusion functions exposed but Java/Ehcache commands are very easy to use
- Ehcache 2.x Engancements
- Cachewriters
- Read-through
- Blocking-cache
- SelfPopulatingCache
- Support for distributed transactions
- Big Memory
- Resources
Comments
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]