PQ75570: POOR BUFFER MANAGEMENT CAUSES PERFORMANCE ERRORS IN THE PACKAGE NAMED...ORG.APACHE.JASPER.RUNTIME CLASS

 A fix may be available

Obtain the fix for this APAR



APAR status
Closed as new function.

Error description
The following code in the package org.apache.jasper.runtime, is
very inefficient because it:
 1. Creates and discards a new, potentially large object that
    is only temporary.
 2. Copies the data two times.
 The following code is suggested to improve the class performanc
 -
 private void reAllocBuff(int i)
{
         char ac[] = new char[bufferSize];
         System.arraycopy(cb, 0, ac, 0, cb.length);
        if(i <= 8192)
        {
            cb = new char[bufferSize + 8192];
            bufferSize += 8192;
        } else
        {
            cb = new char[bufferSize + i];
            bufferSize += i;
        }
        System.arraycopy(ac, 0, cb, 0, ac.length);
        ac = null;
    }

.
This alternative avoides the extra object and eliminates one of
operations
.
         char ac[ ] ;
         if(i <= 8192)
         {
             ac = new char[bufferSize + 8192];  // new array 8K
             bufferSize += 8192;
         } else
         {
             ac = new char[bufferSize + i];     // new array i c
 larger
             bufferSize += i;
         }
     System.arraycopy(cb, 0, ac, 0, cb.length);  // copy old
                                                    data new to
                                                      array
         cb = ac ;                             // make local var
 ref
 new data
         ac = null;                                  // clean up
.
In addition the following code recreates a buffer, which
discards the old buffer
- when in a much simpler algorthm would have the desired effect
and eliminate the extra object creation.
-
The old code
.
.
  public void clear()
         throws IOException
     {
         synchronized(super.lock)
    {
             cb = new char[8192];
             bufferSize = 8192;
             nextChar = 0;
         }
     }
-
The proposed new code ;
public void clear()
         throws IOException
    {
         synchronized(super.lock)
         {
 /*  just empty the buffer, don't reallocate it
*/
           // cb = new char[8192];
           // bufferSize = 8192;
           nextChar = 0;
       }
   }
........ end of suggestion ..........
Local fix Problem summary
****************************************************************
* USERS AFFECTED: All users of WebSphere Application Server    *
*                 version 4.0.1 for z/OS and OS/390            *
****************************************************************
* PROBLEM DESCRIPTION: Performance degradation due to          *
*                      Buffer Management code in               *
*                      org.apache.jasper.runtime.              *
*                                      BodyContentImpl class.  *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
Performance degradation in BodyContentImpl class in JSP Runtime
code. These are the problems found in the code.
  1. Creates and discards a new, potentially large object that
     is only temporary.
  2. Copies the data 2 times.
Problem conclusion Temporary fix Comments
The code was modified to not create an unnecessary temporary
object and also avoided copying the data 2 times.

APAR PQ75570 is associated with SERVICE LEVEL W401509 of
WebSphere Application Server version 4.0.1 for z/OS and OS/390.
APAR information
APAR number PQ75570
Reported component name WEBSPHERE OS/39
Reported component ID 5655A9800
Reported release 401
Status CLOSED UR1
PE NoPE
HIPER NoHIPER
Submitted date 2003-06-24
Closed date 2003-07-09
Last modified date 2003-08-06

APAR is sysrouted FROM one or more of the following:

APAR is sysrouted TO one or more of the following:

Modules/Macros
EJSJWCWC          

Fix information
Fixed component name WEBSPHERE OS/39
Fixed component ID 5655A9800

Applicable component levels
R401 PSY UQ78363    UP03/07/15 P F307

  Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server for z/OS
Operating system(s):
Software version: 401
Software edition:
Reference #: PQ75570
IBM Group: Software Group
Modified date: Aug 6, 2003