Struts 2
  1. Struts 2
  2. WW-3467

Improve performance for page rendering by refactoring freemarker cache

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.1.5, 2.1.6, 2.1.8, 2.1.8.1
    • Fix Version/s: 2.2.1
    • Component/s: None
    • Labels:
      None
    • Flags:
      Patch, Important

      Description

      currently,struts2 have two inconsistent options about freemarker cache
      1.<constant name="struts.freemarker.mru.max.strong.size" value="250" />
      this option will used by freemarker.cache.MruCacheStorage

      2.<constant name="struts.freemarker.templatesCache" value="true" />
      this option will use a internal ConcurrentHashMap in FreemarkerTemplateEngine but not freemarker native cache
      my patch deprecated this option and clean those code

      also add a option to change default update cache interval (5 seconds)
      <constant name="struts.freemarker.templatesCache.updateDelay" value="1800" />

      BTW:set devMode to true will disable cache and update immediately

      using cache will boost great performance, reduce 400ms to 20ms render a xhtml theme form and some textfield in my test .

      I think https://issues.apache.org/jira/browse/WW-2808 could closed by adding a wiki page about how to use freemarker cache

      1. patch.txt
        11 kB
        zhouyanming

        Issue Links

          Activity

          zhouyanming created issue -
          zhouyanming made changes -
          Field Original Value New Value
          Attachment patch.txt [ 12449541 ]
          Lukasz Lenart made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Lukasz Lenart [ lukaszlenart ]
          Fix Version/s 2.2.1 [ 12315170 ]
          Resolution Fixed [ 1 ]
          Vijayakannan made changes -
          Link This issue relates to WW-3765 [ WW-3765 ]
          Lukasz Lenart made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Lukasz Lenart
              Reporter:
              zhouyanming
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development