You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2015/12/30 10:44:49 UTC

[jira] [Commented] (SLING-5277) Performance: per thread script resolver (admin session) is always created even if cache is hit

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

Carsten Ziegeler commented on SLING-5277:
-----------------------------------------

I think there is something wrong with your patch and your performance tests:
In your version, when the DESTROY event is received in the onEvent() method, this.perThreadScriptResolver.get() is called which creates the resource resolver (initial value) just to be closed again. Therefore I fail to see how this can be more performant as the resource resolver is created anyway on each request - nothing is saved.
In addition, changing the creation from the INIT event to an initial value is also a change in behaviour as with the initial value the resource resolver is always cloned on the first get. While with the previous it is only created if an event occurs. I'm not sure about this impact though.

> Performance: per thread script resolver (admin session) is always created even if cache is hit
> ----------------------------------------------------------------------------------------------
>
>                 Key: SLING-5277
>                 URL: https://issues.apache.org/jira/browse/SLING-5277
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>         Attachments: SLING-5277.patch
>
>
> Since SLING-3441, for every request, a new admin / privileged session is [created in the SlingServletResolver|https://github.com/apache/sling/blob/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java#L532]. It is created before the script/servlet cache is checked, so in most cases when the cache is hit it is never used, but the cost of creating an extra session (which can vary, especially with concurrent traffic) is incurred.
> The per thread script resolver can be created lazily instead of directly in the event to avoid this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)