Skip to main content

JAX-WS RI goes truly asynchronous!

Posted by kohsuke on August 21, 2006 at 11:43 AM PDT

As I've talked about in the past, I've been involved with making the JAX-WS RI better architectured. The first wave of that work is now stable enough to be made available as "milestone 1" and also in Glassfish v2 milestone1. Also see Vivek's blog for more about this.

But we aren't done yet. We recently learned that our JBI folks are interested in using the JAX-WS RI and WSIT as a lower level communication layer ("binding component" is their jargon, I think.) And they are very big on asynchrony — they speak of 100,000s of concurrent connections!

So Jitu and I have been working on a prototype of the evolution of the pipeline architecture that supports highly concurrent and asynchronous processing, tentatively dubbed as "valve."

The basic idea is the emulation of the continuation passing style in Java. I've done this more seriously in the dalma project and in a way more transparent to Java applications, but the emulation approach we take for valves is different. It's not transparent, and it's custom-designed for the pipeline processing, so it has much smaller overhead.

CPS allows one thread to juggle multiple concurrent requests, instead of blocking on I/O. Combined with truly asynchronous transports (like Grizzly), it would allow us to achieve a great scalability that otherwise is simply impossible.

The good news is that on the client side, the JAX-WS API already has a programming model to take advantage of this. So when this change is ready, your existing application just gets faster, without changing one line. On the server side, however, we needed a new kind of Provider API that allows middlewares and applications to process requests asynchronously. This is likely go into the JAX-WS RI's private package for a while.

interface AsyncProvider<T> {
  void invoke(T reqeuest, Callback<T> callback, WebServiceContext);
interface Callback<T> {
  void sendReply(T response);
  void sendFault(WebServiceException fault);

If you are interested in more details, see the slides here and here. So, have fun with the JAX-WS RI 2.0.1 m1, and stay tuned for more improvements to come in the future!

Related Topics >>