Issue Details (XML | Word | Printable)

Key: SJSXP-64
Type: Improvement Improvement
Status: Open Open
Priority: Critical Critical
Assignee: Joe Wang
Reporter: jeffrey_sinclair
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Ability to adjust default buffer sizes

Created: 07/Jul/08 06:11 AM   Updated: 15/Jul/08 10:45 PM
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Time Tracking:
Not Specified


Operating System: All
Platform: All

Issuezilla Id: 64
Participants: jeffrey_sinclair and Joe Wang

 Description  « Hide

The memory requirement by SJSXP for small XML messages is high relative to the
size of the message.

For small messages (around 500 bytes), there is in excess of 60x memory
overhead. Most of this overhead comes from two buffers:

  • the buffer used to hold bytes from the initial InputStream.
  • the buffer used to hold decoded XML (e.g. in the UTF8Reader).

I'm not entirely sure why the first buffer is needed at all but nevertheless
both buffers' initial size is 8192. Given that the second buffer is a char[],
these buffers alone take up around 25K which is significant when the messages
are small.

There is the following comment in the source code:


  • Buffer size. We get this value from a property. The default size
  • is used if the input buffer size property is not specified.
  • REVISIT: do we need a property for internal entity buffer size?

I think it would be a good enhancement to reduce the default buffer size when
messages are really small.

This could be done in three ways:

  • through a system property (perhaps a bit too coarse grained but useful for
    running performance tests).
  • through a property on the factory (good since it can be specific to a piece of
    functionality in which the XML messages are around the same size).
  • adaptive, i.e. learns based on message sizes (requires some kind of

As a start, I think it would be good to provide the first two options out of the

Joe Wang added a comment - 15/Jul/08 10:45 PM

Thanks for the suggestion! It looks like a nice performance improvement.
Unfortunately I have been quite occupied and I'm on vacation for a month. I'll
look into it once I come back.