Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-9259

Add SkipCacheJspWriterWrapper to prevent unnecessary temp buffer



      JspWriter's implementation classes usually have a buffer. This buffer can improve performance when you are outputing a lot of small data fragments to the actual IO destination.

      But under two conditions, the buffer can do harm to performance.

      1)The output data is already in big chunk, merging them into a even bigger buffer is pointless, this will only waste a big temp buffer.

      2)The actuall destination is a in-memory IO abstraction, buffering can only cause more data copying.

      RuntimePortletUtil.processTemplate() meets both of these conditions. The output data is already in chunk and most of the time it is actually outputing to a UnsynStringWriter.

      So we should disable the buffer, but unfortunately, the JspWriter object is created by app-server, and Jsp specification does not provide a way to disable the buffer after creation.

      But Jsp specification does define that the buffer size is controled by a protected field in JspWriter. So as long as you are using the standard Jsp specification you can safely turn off the buffer by reflection.

      In MessageBoard benchmark test, this fix reduce 2% young gen collections and 2.5% old gen collections.




            • Assignee:
              support-lep@liferay.com SE Support
              shuyang.zhou Shuyang Zhou
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:
                Days since last comment:
                10 years, 6 weeks, 5 days ago


                Version Package
                6.0.1 RC
                6.0.2 RC