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

Swap out standard JSP taglib BodyContent



      Jsp BodyTag uses BodyContent to cache the tag output for further processing.

      The standard BodyContent implementation uses a growing internal buffer to hold the data. For a complex BodyTag the output can be very large which will cause the internal buffer grows many times. For each growth, it creates a new buffer whose size is double of the old size(or the old size plus new appending data size, if double is not enough), then the old buffer becomes garbage.

      This kind of growing is not effective which can cause massive GC problem, to fix this, i wrap the standard Jsp BodyContentImpl to use UnsyncStringWriter which is actually using StringBundler inside to do a more effective data collecting.

      This improvement is transparent to tag lib, all you need to do is at the beginning of jsp processing swapping out the default JspFactory object.

      For test case like login which does not involve complex BodyTag, this fix almost changes nothing, but for text sensitive test cases, like MessageBoard, this fix can save a lot of GC. Test result showes that for MessageBoard test case this fix save us 66% old gen collection(There is almost no change at young gen, since most BodyContent objects live long enough to promote to old gen).


          Issue Links



              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created:
                  Days since last comment:
                  9 years, 51 weeks, 5 days ago


                  Version Package
                  6.0.1 RC
                  6.0.2 RC