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

Vijayakannan commented on WW-3765:
----------------------------------

<constant name="struts.freemarker.mru.max.strong.size" value="0" />
Our application move to production and don't able to validate the above changes 
due to code freeze


The conclusion for performance issue is loading the template from struts jar 
and freemarker not able to identify the last modification time. to solve this 
we change to application path.

Setup in our Production

<constant name="struts.freemarker.mru.max.strong.size" value="250" />
<constant name="struts.freemarker.templatesCache" value="true" />
<constant name="struts.ui.templateDir" value="WEB-INF/template"/>
<constant name="struts.freemarker.templatesCache.updateDelay" value="86400" />

It's working fine in terms of performance

The only problem in the above setup is parent "theme.properties" file inside 
the child folder is not recognized by freemarker. So we copy all the parent's 
freemarker template into child folder. 

Refer : https://issues.apache.org/jira/browse/WW-3764

Thanks a lot for all your support.

                
> Improve performance of FreeMarker Template caching
> --------------------------------------------------
>
>                 Key: WW-3765
>                 URL: https://issues.apache.org/jira/browse/WW-3765
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Integration
>    Affects Versions: 2.3.1
>         Environment: Tomcat v7.0
>            Reporter: Vijayakannan
>            Priority: Critical
>              Labels: freemarker-template-reload-required
>             Fix For: 2.3.2
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Struts2 having option to enable the freemarker template caching with 
> reloading the template with time delay which helps us to improve the 
> performance.
> In our application we are using the strut2 in-built UI freemarker template. 
> We need the caching option without reloading the templates after the specific 
> time delay.
> Caching option is more powerful if we have an option for enabling\disabling 
> the reload
> Proposed Solution 
> Struts.xml
> <constant name="struts.freemarker.templatesCache.required" value="true"/>
> FreeMarkerManager.java 
> protected boolean templateUpdateRequired;
> @Inject(STRUTS_FREEMARKER_TEMPLATES_RELOAD_REQUIRED)
> public void setTemplateUpdateRequired(String templateUpdateRequired) {
>               this.templateUpdateRequired 
> ="true".equals(templateUpdateRequired);
>       }
> Update createConfiguration(ServletContext servletContext) Method
>    configuration.setSetting(Configuration. TEMPLATE_RELOAD_ REQUIRED _KEY, 
> templateUpdateRequired);
> Configuration.java
>   String TEMPLATE_RELOAD_ REQUIRED _KEY= "template_reload_required";
> TemplateCache.Java
>   protected boolean templateUpdateRequired;
> Update getTemplate(TemplateLoader loader, String name, Locale locale, String 
> encoding, boolean parse) Method
> ...
> if (templateUpdateRequired !=false && now - cachedTemplate.lastChecked < 
> delay) {

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