You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Michael Elman (JIRA)" <ji...@apache.org> on 2009/07/21 12:41:14 UTC

[jira] Commented: (WINK-115) Add caching to MediaTypeMap.getProvidersbyMediaType()

    [ https://issues.apache.org/jira/browse/WINK-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733579#action_12733579 ] 

Michael Elman commented on WINK-115:
------------------------------------

I think this solution may work, just need to remember that we support runtime registration, therefore the cache must be dumped if a new provider is added. 
The convenient way will be putting instance of cache on the MediaTypeMap, so there would be separate caches for message body readers, writers and context resolvers.
So the cache will be dumped only if the provider of the same type is added.

The cache must not be static - there can be multiple instances of Wink in the system with the different configurations.
If the cache is put on instance of MediaTypeMap, there is no need to synchronize, since the ProvidersRegistry is already synchronized.


> Add caching to MediaTypeMap.getProvidersbyMediaType() 
> ------------------------------------------------------
>
>                 Key: WINK-115
>                 URL: https://issues.apache.org/jira/browse/WINK-115
>             Project: Wink
>          Issue Type: Improvement
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Nick Gallardo
>            Assignee: Nick Gallardo
>             Fix For: 0.1
>
>
> Calls to MediaTypeMap.getProvidersByMediaType() are expensive, and happen a multiple times per invocation.  Profiling the runtime shows this as one of the major time blocks in successive get() calls.  
> Once we've done the work to define a mapping between the MediaType and the parameter class, we can cache that content so we don't have to do the same level of processing again.  One way to cache would be to build a Matrix of MediaTypes to Class type mappings.  So, for every MediaType, we can lookup a particular parameter class type and find the cached list of providers that apply to that type.
> Caching this content results in at least 10% performance improvement.
> Working on a patch for this one.  Still trying to workout the caching scheme exactly.  

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