You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Vijayakannan (Created) (JIRA)" <ji...@apache.org> on 2012/02/23 19:18:48 UTC
[jira] [Created] (WW-3765) Improve performance of FreeMarker
Template caching
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
Fix For: 2.3.2
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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Daniel Dekany (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216678#comment-13216678 ]
Daniel Dekany commented on WW-3765:
-----------------------------------
If you set the delay to a sufficiently large value, such as Integer.MAX_VALUE, reloading should never occur due to the update delay (unless you run the server for 70 years). You can still have re-loadings however, if cache drops cached templates because the GC decides so. This can be prevented with using sufficiently large "hard" size in MruCacheStroage.
(I surely hope you don't have a dead locks. That's when something freezes indefinitely because threads waiting on each other mutually.)
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "zhouyanming (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216328#comment-13216328 ]
zhouyanming commented on WW-3765:
---------------------------------
freemarker doesn't controll delay of -1,I have reported a feature request
https://sourceforge.net/tracker/?func=detail&aid=3493744&group_id=794&atid=350794
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Lukasz Lenart (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13248613#comment-13248613 ]
Lukasz Lenart commented on WW-3765:
-----------------------------------
Thanks, I'll close the issue then. If you face the problem again, please open it. I still don't get the problem with theme.properties :/
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Lukasz Lenart (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215425#comment-13215425 ]
Lukasz Lenart commented on WW-3765:
-----------------------------------
Did you implemented that in your application ?
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13249178#comment-13249178 ]
Vijayakannan commented on WW-3765:
----------------------------------
The problem with theme.properties
Getting File not Exception if i tried to load the struts default templates from application path "WEB-INF/template"
SEVERE: Could not open template
java.io.FileNotFoundException: Template /WEB-INF/template/xhtml/a.ftl not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:489)
at freemarker.template.Configuration.getTemplate(Configuration.java:452)
at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:96)
at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:59)
at org.apache.struts2.components.Anchor.start(Anchor.java:132)
I have updated this in https://issues.apache.org/jira/browse/WW-3764 WW-3764 issue too and we can track it @ WW-3764 itself.
Thanks a lot
> 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
> Assignee: Lukasz Lenart
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Commented) (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "zhouyanming (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216350#comment-13216350 ]
zhouyanming commented on WW-3765:
---------------------------------
@Vijayakannan,please try <constant name="struts.freemarker.mru.max.strong.size" value="0" /> to prevent deadlock,please see WW-3766
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215814#comment-13215814 ]
Vijayakannan commented on WW-3765:
----------------------------------
We are also using the same workaround in our project but it's not an optimal solution.
During the performance testing with 800 concurrent user, the getTemplate() method in TemplateCache.java blocks 80 Threads(Deadlocks occur) and this is an major performance issue in our project. Our application should be available for 24/7 and expected concurrent user is more than 7000
One worst day, this workaround will blocks the user threads even if we provide the max long value.
We identified that the root cause of deadlocks is reloading the Freemaker template
For the optimal solution, there should some option to enable\disable the reloading of Freemaker template with cache option
> 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
[jira] [Updated] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vijayakannan updated WW-3765:
-----------------------------
Comment: was deleted
(was: Hope setting the updateDelay=-1 in struts.xml will help us to avoid the template reloading
I have tested the same in sample application. it's working
<constant name="struts.freemarker.templatesCache.updateDelay" value="-1" />
Thanks a lot for all your comments
)
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Philip Luppens (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215831#comment-13215831 ]
Philip Luppens commented on WW-3765:
------------------------------------
Just a quick question: isn't this controlled by the freemarker.properties file with a delay of -1?
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Lukasz Lenart (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216477#comment-13216477 ]
Lukasz Lenart commented on WW-3765:
-----------------------------------
Please report back results of your testing. Thanks!
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216347#comment-13216347 ]
Vijayakannan commented on WW-3765:
----------------------------------
Hope setting the updateDelay=-1 in struts.xml will help us to avoid the template reloading
I have tested the same in sample application. it's working
<constant name="struts.freemarker.templatesCache.updateDelay" value="-1" />
Thanks a lot for all your comments
> 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
[jira] [Resolved] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Lukasz Lenart (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart resolved WW-3765.
-------------------------------
Resolution: Not A Problem
Assignee: Lukasz Lenart
> 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
> Assignee: Lukasz Lenart
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Vijayakannan (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216364#comment-13216364 ]
Vijayakannan commented on WW-3765:
----------------------------------
if (delay<=0 || now - cachedTemplate.lastChecked < delay)
This line changes in freemarker.cache.TemplateCache.java will really help us to avoid reloading of freemarker templates
<constant name="struts.freemarker.mru.max.strong.size" value="0" />
It's working fine.We need to do some more performance testing to ensure the same
Thanks for your comments
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "zhouyanming (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215466#comment-13215466 ]
zhouyanming commented on WW-3765:
---------------------------------
there is a workaround,you can set updateDelay as large as possible
<constant name="struts.freemarker.templatesCache.updateDelay" value="${Long.MAX_VALUE}" />
> 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
[jira] [Commented] (WW-3765) Improve performance of FreeMarker
Template caching
Posted by "Lukasz Lenart (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13245504#comment-13245504 ]
Lukasz Lenart commented on WW-3765:
-----------------------------------
@Vijayakannan any news?
> 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