Hi Simone,
Thanks for the response! CometD sounds like an overkill for this particular use case (we’re talking about a servlet with 200 lines of code :)
Asynchronous writes would work, but the part I’m missing is how can one force a flush to the client before filling up the buffer.
Thanks, Viktor
On July 28, 2016 at 15:12:06, Simone Bordet (sbordet@xxxxxxxxxxx) wrote: Hi,
On Thu, Jul 28, 2016 at 12:28 PM, Viktor Szathmáry <phraktle@xxxxxxxxx> wrote: > Hi, > > Is there a non-blocking way of forcing flushing the output of a servlet? > > The use case is Server-Sent Events, where we’re trying to push messages to a > large number of clients via AsyncContext. Calls to flushBuffer are blocking > and we experience a backlog due to slow clients.
For this particular use case, sending messages to large number of clients, CometD (https://cometd.org) is a much better solution, more scalable, etc.
With Servlet 3.1 async I/O you might be able to avoid blocking. Again, CometD already provides you with a transport based on Servlet 3.1 Async I/O, so you don't have to write this infrastructural code, and you just concentrate on your business.
-- Simone Bordet ---- http://cometd.org http://webtide.com Developer advice, training, services and support from the Jetty & CometD experts. _______________________________________________ jetty-users mailing list jetty-users@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
|