Struts 2
  1. Struts 2
  2. WW-1473

Freemarker performance / caching issue in UI Tags

    Details

      Description

      There's been some performance problem (resulting inFM not caching properly) related to UI tag. see http://article.gmane.org/gmane.comp.web.freemarker.user/2555/match=freemarker+performance+ww

      and

      http://forums.opensymphony.com/thread.jspa?messageID=85432

      for more info.

        Activity

        Hide
        tm_jee added a comment -
        Show
        tm_jee added a comment - And also Alex's findings at http://forums.opensymphony.com/thread.jspa?threadID=26473&messageID=52099#52099
        Hide
        Philip Luppens added a comment -

        Note: if you copy the template/ directory from the webwork or struts jar to the webapp root (where one would 'override' a theme), everything works perfect. All templates get cached. As soon as they come from a jar, hower, things indeed go wrong.

        So, the obvious solution is to copy the templates if you need 'high performance'. Not that it's good one, but it works.

        Show
        Philip Luppens added a comment - Note: if you copy the template/ directory from the webwork or struts jar to the webapp root (where one would 'override' a theme), everything works perfect. All templates get cached. As soon as they come from a jar, hower, things indeed go wrong. So, the obvious solution is to copy the templates if you need 'high performance'. Not that it's good one, but it works.
        Hide
        tm_jee added a comment -

        Hi Phil,

        Can you attached the webapp or any relevant part that you used to do profiling, that shows fm caching isn't caching appropriately? So that others who are interested can have a look as well. Thx a million mate.

        rgds

        Show
        tm_jee added a comment - Hi Phil, Can you attached the webapp or any relevant part that you used to do profiling, that shows fm caching isn't caching appropriately? So that others who are interested can have a look as well. Thx a million mate. rgds
        Hide
        tm_jee added a comment -

        Just some thoughs after reading Phil's comment on having those templates in the webapp folder and they are cached properly.

        If we have them in the webapp/WEB-INF/classes, i am guessing (i didn't try it out) it might work as well. Classes in webapp/WEB-INF/classes should be loaded before jars (according to the spec if i remember it correctly), so i guess the one in webapp/WEB-INF/classes should get picked up first.

        just a thought.

        Show
        tm_jee added a comment - Just some thoughs after reading Phil's comment on having those templates in the webapp folder and they are cached properly. If we have them in the webapp/WEB-INF/classes, i am guessing (i didn't try it out) it might work as well. Classes in webapp/WEB-INF/classes should be loaded before jars (according to the spec if i remember it correctly), so i guess the one in webapp/WEB-INF/classes should get picked up first. just a thought.
        Hide
        Philip Luppens added a comment -

        I'll try to pack this example app as soon as possible - it's on my home computer, but I won't have time till sunday (might be able to squeeze it in somewhere, but I doubt it's going to work). Not that it's so hard to try it yourself ..
        Basic profiling was done with YourKit profiler and JMeter. Used 3 types of pages: single tag, single tag repeated 100 times on the page, and 'all form tags'. I should also take a look at freemarker vs jsp performance, and if possible try to remove the jsp tags in the templates. I want to see what's the impact of that as well.

        Show
        Philip Luppens added a comment - I'll try to pack this example app as soon as possible - it's on my home computer, but I won't have time till sunday (might be able to squeeze it in somewhere, but I doubt it's going to work). Not that it's so hard to try it yourself .. Basic profiling was done with YourKit profiler and JMeter. Used 3 types of pages: single tag, single tag repeated 100 times on the page, and 'all form tags'. I should also take a look at freemarker vs jsp performance, and if possible try to remove the jsp tags in the templates. I want to see what's the impact of that as well.
        Hide
        tm_jee added a comment -

        That's great, Sunday's fine. Thx Phil. Oh... and take your time

        I've tried with a single tag, it seems that fm caching is working, from the log (freemarker.cache) but it might just be too simple. When the tag is repeated over a huge number, it seems to be quite slow though.

        Show
        tm_jee added a comment - That's great, Sunday's fine. Thx Phil. Oh... and take your time I've tried with a single tag, it seems that fm caching is working, from the log (freemarker.cache) but it might just be too simple. When the tag is repeated over a huge number, it seems to be quite slow though.
        Hide
        Don Brown added a comment -

        Moving to future as it still isn't clear exactly what needs to be done

        Show
        Don Brown added a comment - Moving to future as it still isn't clear exactly what needs to be done
        Hide
        Don Brown added a comment -

        I believe recent changes in the caching strategy for Freemarker have resolved this issue. Reopen if it is still a problem.

        Show
        Don Brown added a comment - I believe recent changes in the caching strategy for Freemarker have resolved this issue. Reopen if it is still a problem.

          People

          • Assignee:
            Don Brown
            Reporter:
            tm_jee
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development