myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (Resolved) (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Resolved] (MYFACES-3458) [perf] Store URL at class ResourceImpl
Date Mon, 13 Feb 2012 16:47:00 GMT

     [ https://issues.apache.org/jira/browse/MYFACES-3458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Leonardo Uribe resolved MYFACES-3458.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.7
                   2.0.13
         Assignee: Leonardo Uribe

Thanks to Jesús Pérez for contribute with this performance improvement.
                
> [perf] Store URL at class ResourceImpl
> --------------------------------------
>
>                 Key: MYFACES-3458
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3458
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.1.3, 2.1.5
>         Environment: Websphere Application Server v7
> Windows 2003 Server
> Double quad-core Intel Xeon CPU
>            Reporter: Jesús Pérez Alcaide (ISBAN)
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.13, 2.1.7
>
>         Attachments: ResourceImpl_getURL_blocked.png
>
>
> Doing stress tests on a JSF application we have noticed some contention.
> 14% of the time that the threads are blocked is due to calls to ClassLoader#getResource(String).
Such calls comes from method  org.apache.myfaces.shared.resource.ResourceImpl#getUrl(). (see
attached image)
> Viewing the code of the method ResourceImpl#getURL(), it is always calculating the URL
of the resource through the ResourceLoader. This, in turn, ends up calling the method ClassLoader#getResource(String).
>     public URL getURL()
>     {
>         return getResourceLoader().getResourceURL(_resourceMeta);
>     }
> Since the resulting URL will not change during the life of the resource instance, it
could be stored in an instance variable and thus prevent subsequent calls to this method end
up calling the ClassLoader.
>     private URL _url;
>     public URL getURL()
>     {
>     	if (_url == null) {
>     		_url = getResourceLoader().getResourceURL(_resourceMeta);
>     	}
>         return _url;
>     }
> With this change applied we obtained a performance improvement between 14% and 119% of
throughput, depending on the complexity of the rendered view.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message