Hi,

2017-02-07 11:54 GMT+02:00 Rémy Maucherat <r...@apache.org>:
>
> 2017-02-06 20:55 GMT+01:00 Violeta Georgieva <violet...@apache.org>:
>
> > Hi,
> >
> > Currently JSR356 provides possibility to add message handlers in order
to
> > receive web socket
> > messages but there is no way to instruct the web socket implementation
to
> > suspend for a while
> > the incoming messages (backpressure) so that the application is able to
> > process the already delivered messages.
> > The other web containers (Jetty, Undertow) supports such functionality
so I
> > would like to introduce it in Tomcat.
> > Here [1] I prepared one possible implementation.
> >
> > What do you think about this feature and the proposed implementation?
> >
>
> I don't understand why this is that useful (it has to be used in a smart
> way that improves scalability by the application, I'm not convinced this
> can happen) but more importantly it's a proprietary API.

This functionality is needed in order to provide a proper implementation of
reactive streams for Tomcat.
https://github.com/reactive-streams/reactive-streams-jvm

Imagine that the component that is consuming the messages cannot accept
anymore.
On one hand there is no way to tell Tomcat to stop sending messages, on the
other non-blocking is expected.
A solution would be to buffer the messages in the memory, but the buffering
cannot be done without limits.
So if there is an API to tell Tomcat to stop reading it will be better than
buffering in the memory, which easily can lead to out of memory issues.

As there is no a standard, the API is proprietary. But it is needed and
other servers also provided it.
For sure there are other use cases than the one I mentioned above.

Regards,
Violeta


> Rémy
>
> >
> > Regards,
> > Violeta
> > [1] https://github.com/violetagg/tomcat/commits/ws-suspend-resume
> >

Reply via email to