You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Remy Maucherat <re...@apache.org> on 2013/09/23 18:43:58 UTC

[WS] To flush or not to flush

Hi Mark,

Unless I missed something, Websockets 1.0 on Servlet 3.1 upgrade doesn't
do much flushing, so that the IS/OS used in upgrade must effectively
just write immediately the data (and ensure it is really sent over the
wire).

I find that a bit weird, since during the design of Servlets 3.1, the
idea was to retain buffering. Of course, upgrade was then added, char
support was taken out of the new IO, and it should be feasible to use
this sort of bufferless streams in upgraded mode. But that's a lot of
assumptions, shouldn't the websockets implementation just flush ? In any
case it would be good to have the buffer vs no buffer choice clarified
for the upgraded mode [to be honest, I thought it was like the regular
Servlet 3.1 IO mode, minus the HTTP transfer encodings].

Thanks,
Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [WS] To flush or not to flush

Posted by Remy Maucherat <re...@apache.org>.
On Tue, 2013-09-24 at 06:34 -0700, Mark Thomas wrote:
> Non-blocking IO with non-upgraded streams still uses the standard
> buffering mechanisms.
> 
> I agree some clarification is required. When section 5.1 discusses
> buffering, it does so in the context of the ServletResponse object so it
> isn't immediately obvious how the buffer should be controlled (or even
> if it should exist) in the upgraded scenario.

Yes, that's correct, everything is described with the Servlet POV, so
the upgraded mode is undefined as far as buffering goes (so unbuffered
is correct).

Assuming a buffering scenario, I could add sos.flush() (which is a noop
currently) on line 92 in WsRemoteEndpointImplServer, that looks to me
the right location.

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [WS] To flush or not to flush

Posted by Mark Thomas <ma...@apache.org>.
On 23/09/2013 09:43, Remy Maucherat wrote:
> Hi Mark,
> 
> Unless I missed something, Websockets 1.0 on Servlet 3.1 upgrade doesn't
> do much flushing, so that the IS/OS used in upgrade must effectively
> just write immediately the data (and ensure it is really sent over the
> wire).

Correct. Unless batching is enabled, writes go immediately.

> I find that a bit weird, since during the design of Servlets 3.1, the
> idea was to retain buffering. Of course, upgrade was then added, char
> support was taken out of the new IO, and it should be feasible to use
> this sort of bufferless streams in upgraded mode. But that's a lot of
> assumptions, shouldn't the websockets implementation just flush ? In any
> case it would be good to have the buffer vs no buffer choice clarified
> for the upgraded mode [to be honest, I thought it was like the regular
> Servlet 3.1 IO mode, minus the HTTP transfer encodings].

Tomcat's implementation doesn't buffer upgraded streams at all.

Non-blocking IO with non-upgraded streams still uses the standard
buffering mechanisms.

I agree some clarification is required. When section 5.1 discusses
buffering, it does so in the context of the ServletResponse object so it
isn't immediately obvious how the buffer should be controlled (or even
if it should exist) in the upgraded scenario.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org