Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] How to use async processing with 3.1 async IO correctly?

I've been using servlet 3.0 async processing using Jetty 9.0.6.v20130930 quite nicely- able to handle 7k+ concurrent connections on commodity hardware. Now that Jetty 9.1 is GA, I'm trying to use async IO on top of async processing. 

Essentially, in my worker thread which processes async context, instead of directly writing to output stream, I've set WriteListener which in turn writes to output stream. The problem is that after processing few requests, Jetty is not accepting new connections- it kind of hangs. Existing client connections eventually time out. 

Is there a sample code available somewhere which shows how to use async processing with async IO? 

If we take this code as an example- https://gist.github.com/keesun/1621658, I'm modifying line #42 - 
asyncContext.getResponse().getWriter().printf("ticker: %s, price: %.2f", ticker, price);

and replacing it with 

ServletOutputStream out = response.getOutputStream();
out.setWriteListener(new StandardDataStream(content,async,out));


but as I mentioned, after processing few requests, Jetty becomes unresponsive. 

Any pointers on how to resolve this issue?
Thanks in advance, 
Gaurav



Back to the top