Mark=2C overhead of chunked encoding can be significant. My typical message=
is about 50 bytes and chunked encoding takes 6 bytes per message: about 12=
%. I use JSON protocol that is already compressed (the way JSON can be comp=
ressed).
Using "Connection: close" with "Content-Length" header omitted is perfectl=
y valid from HTTP perspective. The end of response is detected by terminati=
ng connection on the server side.=20
In fact some browsers have problems detecting connection termination (and h=
ost of other issues) related to the chunked encoding.
While I understand it is not a Tomcat issue=2C it will score some points fo=
r Tomcat if this is addressed by adding a configuration option.
Thanks
> Date: Wed=2C 5 Jan 2011 06:14:18 +0000
> From: markt@apache.org
> To: users@tomcat.apache.org
> Subject: Re: How to disable chunked encoding for the Http11NioProtocol co=
nnector.
>=20
> On 05/01/2011 05:04=2C ilya goberman wrote:
> >=20
> > Hi=2C
> > I use NIO HTTP Tomcat connector org.apache.coyote.Http11NioProtocol to =
implement Comet streaming to browsers and mobile devices.
> >=20
> > I would like to disable HTTP response chunked encoding to reduce bandwi=
dth.
>=20
> How significant is the overhead with chunking in your case? I'd expect
> it to be pretty small unless only a few bytes are sent at a time (and
> even then there is the overhead for the packet).
>=20
> Is there any mileage in using compression to reduce bandwidth instead?
> Issues with flushing compressed output streams [1] were fixed last year.
>=20
> > The response will have header "Connection: close" with "Content-Length"=
header omitted.
> > Is there a way to do it besides having client send HTTP 1.0 request (th=
at is not possible in the majority of cases)?
>=20
> Having looked at the relevant source code the only two ways I can see are=
:
> - sending an HTTP 1.0 request
> - declaring a content length
>=20
> It used to be possible to control this by disabling keep-alive but that
> was changed back in April last year [2]=2C[3] as a result a discussion on
> the dev list [4]. If your Tomcat version is old enough=2C you may still b=
e
> able to use the disable keep-alive trick.
>=20
> My own view was then=2C and is now=2C that the extra bytes with chunking =
are
> a price worth paying for the client to be able to determine if the
> request is complete. That said=2C an option on the connector to revert to
> non-chunked responses when keep-alive is disabled for use cases where
> reducing bandwidth is more important than knowing if the response is
> complete seems reasonable to me.
>=20
> Mark
>=20
> [1] http://issues.apache.org/bugzilla/show_bug.cgi?id=3D48738
> [2] http://svn.apache.org/viewvc?rev=3D931709&view=3Drev
> [3] http://svn.apache.org/viewvc?rev=3D932913&view=3Drev
> [4] http://markmail.org/message/pim62zhlw4cii7ve
>=20
> ---------------------------------------------------------------------
> To unsubscribe=2C e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands=2C e-mail: users-help@tomcat.apache.org
>=20
=
|