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

Daniel Dekany commented on WW-3766:
-----------------------------------

Access to MruCacheStorage is serialized by its caller (TemplateCache) when 
getting/adding/removing an entry, as it doesn't implement synchronization 
itself. (This stands for all CacheStorage implementations that doesn't mark 
itself as thread-safe.) But all of those operations should take a very short 
time, since they never involve I/O or template parsing or anything heavy. A 
CacheStorages is really just a simple associative array. It's just like having 
a synchronized(myMap) { myMap.get(key); } somewhere in your code. I would be 
surprised if this is something that is a bottleneck in any real-world 
application. So what seems to be the problem exactly?
                
> remove struts.freemarker.mru.max.strong.size from default.properties
> --------------------------------------------------------------------
>
>                 Key: WW-3766
>                 URL: https://issues.apache.org/jira/browse/WW-3766
>             Project: Struts 2
>          Issue Type: Improvement
>            Reporter: zhouyanming
>            Priority: Critical
>              Labels: freemarker
>
> if struts.freemarker.mru.max.strong.size > 0 ,freemarker will use 
> MruCacheStorage instead of SoftCacheStorage,and MruCacheStorage is not 
> concurrent,it will synchronized on every call,it will affect performance. 
> in TemplateCache:
>         CachedTemplate cachedTemplate;
>         if(isStorageConcurrent) {
>             cachedTemplate = (CachedTemplate)storage.get(tk);
>         }
>         else {
>             synchronized(storage) {
>                 cachedTemplate = (CachedTemplate)storage.get(tk);
>             }
>         }
> please remove struts.freemarker.mru.max.strong.size from default.properties 
> lets developers make their own choice.
> a better solution is implements a concurrent MruCacheStorage for struts2

--
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

        

Reply via email to