cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Henne <>
Subject Re: Thinking about buffer length and serialization
Date Mon, 05 Nov 2001 17:18:42 GMT
Jörn Heid wrote:
> With the patch from Joerg Henne you can set a buffer length for the
> serializer.
> The problem is that this is realized through wrapping the original
> outputstream with a buffered one.
> The buffered one can be parameterised - the other depends on the servlet
> engine.
> To set the buffer length of the original output stream the method
> HttpServletResponse.setBufferSize could be used. But as far as I know, the
> serializer has no access to that object.
> So, the buffer length of the serializer must be greater than the buffer
> length of the original output to have an effect.

Caveat: some stuff below is based on Tomcat 4. Tomcat 3 and other servlet
containers may behave differently and YMMV.

Regarding the serialization process you have to discern two things: the way
the data is passed to the servlet container (i.e. the HttpResponseStream) and
the way the data is put onto the network.
The primary motivation behind my patches is that the HttpResponseStream, in
the absence of a known content-length, will use a chunked transfer-encoding to
send data to the client. This means that for every call to write, the client
will be sent the size of the chunk as a hex string, a CR/LF, the chunk data,
and another CR/LF. Combined with the fact that the Xalan serializer issues
single-byte writes only, this caused an excessive amount of data in the wire.

In contrast to that, the ResponseBase (from which HttpServletResponse is
derived) will buffer the data (with a default buffer size of 1024) before it
hits the wire in order to keep the overhead down.

I understand that you are trying to achieve a streaming operation of the whole
pipeline, but I don't understand your last sentence. I don't think that the
serializer has to use a larger buffer than the response stream, because both
levels of buffering serve different purposes. 

Joerg Henne

To unsubscribe, e-mail:
For additional commands, email:

View raw message