[ 
https://issues.apache.org/jira/browse/SLING-1010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726028#action_12726028
 ] 

Carsten Ziegeler commented on SLING-1010:
-----------------------------------------

Ok, we have to distinguish the two caching approaches. This issue is about 
caching in the resource resolver. It caches the case where resources a tried to 
get but they don't exist.

The other caching happens in the script resolver (SLING-1022) where we already 
use a ConcurrentHashMap to avoid the syncs :) - Now for the script resolver 
cache the following applies:
It's right that the whole cache will be invalided whenever something changes 
under the configured search paths (/libs and /apps by default). Clearing the 
whole cache is much easier than trying to figure out what exactly to invalide 
(due to the overlay, the resource type inheritance etc.).
Now, you're right that the delivering of JCR events and clearing the cache 
might occur after already new requests are comming in. In this case several 
things can happen: if a script has been added, still the old one might be used, 
if a script has been updated, it should work. The problematic part is if a 
script has been removed. In this case the jcr node is checked for the last 
modified (to recompile the script in the jsp case) and that node doesn't exist 
anymore which then results in an error (I guess, I haven't tested it yet). But 
I've no good idea atm how to handle this.

With the script resolver caching in place (SLING-1022), this issue here does 
not bring any performance win - at least according to my tests.

> Add cache to speed up resolution of missing JCR resources
> ---------------------------------------------------------
>
>                 Key: SLING-1010
>                 URL: https://issues.apache.org/jira/browse/SLING-1010
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR Resource
>            Reporter: Jukka Zitting
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>         Attachments: MissingPathCache.patch
>
>
> As recently discussed [1], I'm trying to speed up resolution of resources 
> that don't exist. The resource resolution algorithm in Sling is very 
> powerful, but it also needs to look at many different paths when a particular 
> resource does not exist.
> I've implemented a simple cache that is designed to work around this 
> performance issue until the speed of such negative repository path lookups 
> has improved.
> [1] http://markmail.org/message/wlamd7xvagaexmzu

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to