SiteCacheImpl is incompatible with distributed/JSR-107 caching

Description

As part of KNL-1162, I am working on removing the direct bindings to Ehcache from the various caches in Sakai core and moving the kernel (and the rest of the core) towards JSR-107 compliance. As part of this effort I noticed that some caches use Ehcache directly (like org.sakaiproject.site.impl.SiteCacheImpl). For this case it looks like it was mainly to get access to Ehcache notifications via CacheEventListener. This appears to be because some of the cached data is replicated into a series of maps (m_tools, m_pages, m_groups) which then have to be manually cleared when the data is flushed.

That code originated in https://jira.sakaiproject.org/browse/KNL-652

This strategy of partly caching some data in the local object in maps is incompatible with modern caching systems and distributed caching. In order to move Sakai towards better support for scaling this strategy has to change.

org.sakaiproject.site.impl.SiteCacheImpl
kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheImpl.java

Attachments

3

Activity

Show:

Hudson CI Server April 25, 2014 at 11:07 PM

Integrated in sakai-trunk-java-1.7 #217 (See http://builds.sakaiproject.org:8080/job/sakai-trunk-java-1.7/217/)
SiteCacheImpl is incompatible with distributed/JSR-107 caching
This leaves the old SiteCacheImpl in place when using legacy MS and adds a new one for use with the JSR-107 MS (Revision 308862)

Result = SUCCESS

Aaron Zeckoski April 25, 2014 at 8:51 PM

Ready for merge

Sam Ottenhoff April 24, 2014 at 4:24 PM

Okay, I'm seeing good results from the latest patch with local testing. I have ehcache on full DEBUG and Sakai's MemoryService on DEBUG and my logs look correct (cache miss on first view, cache hit on subsequent requests).

My stats also look good:

org.sakaiproject.site.api.SiteService.userSiteCache Ehcache: count:2 hits:88 misses:5 hit%:94
org.sakaiproject.site.impl.SiteCacheImpl.cache Ehcache: count:581 hits:4391 misses:691 hit%:86
org.sakaiproject.site.impl.SiteCacheImpl.cacheGroups Ehcache: count:0 hits:0 misses:0 hit%:0
org.sakaiproject.site.impl.SiteCacheImpl.cachePages Ehcache: count:102 hits:0 misses:0 hit%:0
org.sakaiproject.site.impl.SiteCacheImpl.cacheTools Ehcache: count:118 hits:143 misses:0 hit%:100

Aaron Zeckoski April 24, 2014 at 11:28 AM

Waiting for review and then will apply and test for 10 merge

Aaron Zeckoski April 24, 2014 at 9:07 AM

Attaching first pass at this patch
This is 10 safe as it will use the old SiteCacheImpl when using legacy memoryservice code.

There are issues though (with existing and new):
1) Site cache has mixed values (SIte and Boolean)
2) The Group/SitePage/ToolConfiguration entries could possibly change without the Site cache getting expired
3) BaseSite is NOT serializable and therefore can never be distributed as it currently exists (as placed in the cache)

Basically, the site caching itself needs seriously thought and reworking before it can work as needed

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created April 9, 2014 at 9:20 AM
Updated April 25, 2018 at 3:19 PM
Resolved April 25, 2014 at 8:50 PM