title: Freemarker Performance
body: <p>Hi i have a legacy program which uses struts 2.0.11 with spring 2 and using freemarker 2.4.23 as the template engine.</p>
  <p>My <code>struts.properties</code> are as follows:</p>
  <pre><code>struts.freemarker.wrapper.altMap=true
  struts.freemarker.mru.max.strong.size =250
  struts.freemarker.beanwrapperCache=true
  struts.freemarker.templatesCache=true
  struts.freemarker.templatesCache.updateDelay=600000  
  </code></pre>
  <p>We notice that there is always a delay of a few seconds when the last line of our jsp content is processed. For example, this is an extract from our log:</p>
  <blockquote>
  <p>[6/12/16 15:41:42:253 SGT] 0000014b SystemOut     O [12/6/2016 15:41:42] INFO [WebContainer : 5]  | End Session:2016-06-12 15:41:42.252</p>
  <p>[6/12/16 15:41:44:794 SGT] 0000014b TimerIntercep I com.opensymphony.xwork2.interceptor.TimerInterceptor doLog Executed action [/!execute] took 4195 ms.</p>
  </blockquote>
  <p>I am still not sure what causes the 2 second delay. Can any experts on freemarker explain this?</p>
  <p>Part of the thread dump</p>
  <pre><code>at com.ibm.wsspi.webcontainer.facade.ServletContextFacade.getRealPath(ServletContextFacade.java:243)
      at freemarker.cache.WebappTemplateLoader.findTemplateSource(WebappTemplateLoader.java:103)
      at freemarker.cache.MultiTemplateLoader.findTemplateSource(MultiTemplateLoader.java:73)
      at freemarker.cache.TemplateCache.findTemplateSource(TemplateCache.java:788)
      at freemarker.cache.TemplateCache.lookupTemplateWithAcquisitionStrategy(TemplateCache.java:748)
      at freemarker.cache.TemplateCache.access$500(TemplateCache.java:58)
      at freemarker.cache.TemplateCache$TemplateCacheTemplateLookupContext.lookupWithAcquisitionStrategy(TemplateCache.java:914)
      at freemarker.cache.TemplateCache$TemplateCacheTemplateLookupContext.lookupWithLocalizedThenAcquisitionStrategy(TemplateCache.java:934)
      at freemarker.cache.TemplateLookupStrategy$Default020300.lookup(TemplateLookupStrategy.java:105)
      at freemarker.cache.TemplateCache.lookupTemplate(TemplateCache.java:736)
      at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:372)
      at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:291)
      at freemarker.template.Configuration.getTemplate(Configuration.java:2383)
      at freemarker.core.Environment.getTemplateForInclusion(Environment.java:2478)
      at freemarker.core.Include.accept(Include.java:162)
      at freemarker.core.Environment.visit(Environment.java:326)
      at freemarker.core.Environment.visit(Environment.java:332)
      at freemarker.core.Environment.include(Environment.java:2505)
      at freemarker.core.Include.accept(Include.java:171)
      at freemarker.core.Environment.visit(Environment.java:326)
      at freemarker.core.Environment.visit(Environment.java:332)
      at freemarker.core.Environment.process(Environment.java:305)
      at freemarker.template.Template.process(Template.java:384)
      at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:168)
      at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
      at org.apache.struts2.components.UIBean.end(UIBean.java:484)
      at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
      at com.ibm._jsp._generalenquirysearch._jspx_meth_s_select_0(_generalenquirysearch.java:3500)
      at com.ibm._jsp._generalenquirysearch._jspx_meth_s_form_0(_generalenquirysearch.java:7904)
      at com.ibm._jsp._generalenquirysearch._jspService(_generalenquirysearch.java:806)
      at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
  </code></pre>