Discussions

News: Async Servlet 3.0 Proposal for JSR 315

  1. Async Servlet 3.0 Proposal for JSR 315 (24 messages)

    Greg Wilkins has submitted a proposal to address the asynchronous concerns of JSR315 for the Servlet 3.0 specification process. The proposal is available here and this is an introductory blog about it. In the proposal, additional capabilities are required by the container (in handling more mime types by specification), and more methods are available in servlet request and response objects, to manage suspension and resumption of requests (as the use of continuations would imply.) The deployment descriptor for web applications would be altered to indicate how to convert types, and to indicate whether a given servlet was asynchronous or not. While the proposal is heavily influenced by Jetty Continuations, it tries to avoid some of the more contentious issues of continuations. What do you think of the proposal?

    Threaded Messages (24)

  2. A good idea[ Go to top ]

    I think standardizing this in the spec is definitely a good idea. WebLogic Server also has had an asynchronous servlet mechanism similar to Jetty continuations since the 9.x release with the Future Response Servlet and the Abstract Asynchronous Servlet. It would be nice to have a standard so that developers could expect this api to be consistent across products.
  3. Re: A good idea[ Go to top ]

    This is a good thing. I've been wanting this for 3 or 4 years now. It gets asked for by many customers. Problem will be it will need care to use properly, lots of scope for abuse. I'm first to predict a framework to make this easier.
  4. Really good idea!!! But there is a Big problem, httprotocol. At now, 2007, and look next year BEIJING 2008 og, but we still stop at http-browser age. Someone hold this, for money; Someone hold this, for stupid; You? I, or he? I think, why not give up this way, pickup an another way. Maybe servlet can throw away http, container can do this, So servlet can be very clean. Hope more beautiful tommow!
  5. Agreed![ Go to top ]

    Seventeen four donkey. JSP servlet happy tomorrow indeed: more beautiful tommow! ....dude, what are you talking about?!
  6. Re: Agreed![ Go to top ]

    Simple! just one world: If servlet go on like this way, it does not know how it die. A hint: Do evil, Do die.
  7. SB[ Go to top ]

    SB
  8. SB can see what?[ Go to top ]

    Hei, just take a look at this from http://enunciate.codehaus.org/ Here's the deal: you develop your complete Web API in source code. Make sure it's well-documented and that the metadata is correct, !! but don't worry about deployment descriptors, servlet configuration, packaging, or even interoperability !! Why? Servlet do thing which no need to do that. Haa, SB can see this?
  9. clean TSS[ Go to top ]

    To clean TSS language place, we must run this code: public void cleanTSS(Someone someone) { someone.comein(); try { someone.talk(); } catch (Mess mess) { Util.returnToMouth(someone, mess); } finally { someone.clean(); } }
  10. Re: A good idea[ Go to top ]

    I agree formalizing this will be a good thing, though I'm currently using the Jetty Continuations Module w/DOJO client API and it's working quite well.
  11. Let the spec be aggressive![ Go to top ]

    It is certainly a good idea, a MUST at some point (bout 2 years ago???) though I expect the initial implementations will still have those nuances which makes deploying across different containers great fun. Cheers to Qinxian and the best post I have seen in a fortnight. ~tim
  12. Good job[ Go to top ]

    Definitely Greg has done a good job, and this spec is something that the market has been asking for in the last two years. However, doing a constructive critic, I wouldn't extend the current Servlet interfaces with the asynchronous stuff. I know that this is the approach that Jetty uses ( I have used Jetty continuations for some time ), so fair enough to propose it. But my personal opinion is that it is unnecessary to mix the synchronous/asynchronous stuff. We already have a very good example in the JEE world. When MDBs where introducted to the platform a new bean was created instead of bloating up session beans with asynchronous stuff. An both session beans and message driven beans have been proven successful. So I guess that a similar approach for having asynchronous and synchronous Servlets could be a good idea.
  13. WebLogic supports this today[ Go to top ]

    We have been shipping this internally at WebLogic since 5.1 where we used this to implement HTTP tunneling for RMI and then later as an extension to the Servlet specification in I think WebLogic 6.1 where any customer could take advantage of it. Needless to say it makes a ton of sense for the specification to finally support it. I also agree with most of Greg's comments about how both WebLogic and Tomcat's current implementations are not sufficient.
  14. The Simple[1] framework offers asynchronous collection of content in this form for a long time. It also enables requests to be suspended and does not tie the servicing thread to the response completion. Completion is driven through a monitoring system based on the content delimiter, just like any client does it via the RFC. One thing occurs to me about asynchronous delivery is that there needs to be a balance between a "push back" from blocking writing and totally asynchronous delivery, for instance a server will almost always produce far more than it coonsumes, if the servlet output stream does not block then what happens when a ton of content is streamed from a servlet? You need to allow an asynchronous window and begin blocking when memory concerns arise under high load. Just my thoughts on it! [1] http://www.simpleframework.org
  15. It's a bout frickin' time! So far DWR works with Jetty only. Cometd works with Jetty only too. I'm sure there's more that, thanks to Greg, only work with Jetty. Keep up the good work Greg and push for Continuations in the JSR! Please!
  16. As someone who's been using AsyncWeb (http://docs.safehaus.org/display/ASYNCWEB/Home) for asynchronous web servers for a while now, this is good news. Asynchronous support in the servlet API is long over due.
  17. I don't think you'd get much traction in changing the interfaces-- it'd be a big hurdle for backwards compatibility-- instead you'd probably have to extend/modify HttpServletRequest and HttpServletResponse.
  18. I don't think you'd get much traction in changing the interfaces-- it'd be a big hurdle for backwards compatibility-- instead you'd probably have to extend/modify HttpServletRequest and HttpServletResponse.
    Isn't the asynchronous character just as relevant for the non-HTTP servlet cases as well? (OK, there really aren't any, but that's the implication of the API.) What about taking Greg's interface definitions and, rather than adding to the existing ServletRequest/ServletResponse interfaces, define new optionally implemented (perhaps even per request) interfaces AsynchronousServletRequest/AsynchronousServletResponse?
  19. I don't think you'd get much traction in changing the interfaces-- it'd be a big hurdle for backwards compatibility-- instead you'd probably have to extend/modify HttpServletRequest and HttpServletResponse.


    Isn't the asynchronous character just as relevant for the non-HTTP servlet cases as well? (OK, there really aren't any, but that's the implication of the API.)

    What about taking Greg's interface definitions and, rather than adding to the existing ServletRequest/ServletResponse interfaces, define new optionally implemented (perhaps even per request) interfaces AsynchronousServletRequest/AsynchronousServletResponse?
    Sure, it's just that Servlet has to stay the unfaltering rock of the webtier (good and bad) and the interface change in the proposal wouldn't fly with many people.
  20. I don't think you'd get much traction in changing the interfaces-- it'd be a big hurdle for backwards compatibility-- instead you'd probably have to extend/modify HttpServletRequest and HttpServletResponse.
    Isn't the asynchronous character just as relevant for the non-HTTP servlet cases as well? (OK, there really aren't any, but that's the implication of the API.) What about taking Greg's interface definitions and, rather than adding to the existing ServletRequest/ServletResponse interfaces, define new optionally implemented (perhaps even per request) interfaces AsynchronousServletRequest/AsynchronousServletResponse?
  21. The Servlet API has been very successful IMO because it focused on being low level, with most of the interesting features being implemented inside high level frameworks. Today, I think no end user webapp developer should be writing raw Servlets, and the trend should continue in Servlets 3.0 (its expert group, BTW, has not even been formed, and will be the right place to discuss proposals). The most sensible solution, assuming there's a real demand, is to provide a low level event based non blocking API, which would allow building any sort of higher level constructs on top of it (like content producers and "continuations"). These constructs would be defined in frameworks (Seam, etc). So I am opposed to this proposal, and would prefer generic capabilities. The real question is if users need to be exposed to async functionality at all. It does indeed bring a scalability gain (for modern OSes, you mostly save memory since sockets and the scheduler are no longer a problem) in real webapps beyond the almighty chat example. Many heavyweight webapps consume a lot of resources when processing requests or maintaining their state, and this might completely hide gains these advanced IO features would bring. I don't know at the moment if users have really considered that.
  22. Today, I think no end user webapp developer should be writing raw Servlets
    Definitely; but the implementors of frameworks that provide asynchronous features need a standard API. To provide Ajax Push with ICEfaces we currently support the asynchronous features in Jetty, Tomcat 6, and our own Asynchronous HTTP server, but we need to add WebLogic 9.1 and Grizzly to this list. The APIs for each of the different servers are very different (even at a conceptual level) so I can say that we would be very happy to see a standard API.
    the trend should continue in Servlets 3.0 (its expert group, BTW, has not even been formed, and will be the right place to discuss proposals).
    I agree, this is not the right place to officially discuss Servlets 3.0. It is, however, the right place to discuss how to augment the current Servlet API with asynchronous capabilities -- any ideas we can gather here will be very useful in JSR-315 discussions.
    The most sensible solution, assuming there's a real demand, is to provide a low level event based non blocking API, which would allow building any sort of higher level constructs on top of it (like content producers and "continuations"). These constructs would be defined in frameworks (Seam, etc). So I am opposed to this proposal, and would prefer generic capabilities.
    An event-based approach also has a lot of merit. The question here may be how to deal with Servlet filters (if servlet filters are expected to all run within the call stack of the service() method). However, it should be possible to define an event-based filter API (it may be difficult to accommodate existing filters).
    The real question is if users need to be exposed to async functionality at all. It does indeed bring a scalability gain (for modern OSes, you mostly save memory since sockets and the scheduler are no longer a problem) in real webapps beyond the almighty chat example. Many heavyweight webapps consume a lot of resources when processing requests or maintaining their state, and this might completely hide gains these advanced IO features would bring. I don't know at the moment if users have really considered that.
    Web 2.0 is all about collaboration between users and asynchronous server features are one of the key pieces in developing collaborative applications. Chat is the most basic example, but if you reflect a bit, it's easy to imagine how collaborative capability can be added to nearly any application. When asynchronous responses are driven by the server, the state need not be maintained continuously -- it can be lazily constructed from the database just for that response. Asynchronous Servlet features allow us to do this with a bounded number of threads (are thousands of threads really feasible on current operating systems?).

  23. The most sensible solution, assuming there's a real demand, is to provide a low level event based non blocking API, which would allow building any sort of higher level constructs on top of it (like content producers and "continuations"). These constructs would be defined in frameworks (Seam, etc). So I am opposed to this proposal, and would prefer generic capabilities.

    An event-based approach also has a lot of merit. The question here may be how to deal with Servlet filters (if servlet filters are expected to all run within the call stack of the service() method). However, it should be possible to define an event-based filter API (it may be difficult to accommodate existing filters).
    Yes, Tomcat 6.0 also defines filters (and valves) for these events. Note: The current Tomcat 6.0 has a functionally incomplete API. It allows doing a lot of things, but not everything that I hoped for. A small extension of the API should achieve acceptable results.
    Web 2.0 is all about collaboration between users and asynchronous server features are one of the key pieces in developing collaborative applications. Chat is the most basic example, but if you reflect a bit, it's easy to imagine how collaborative capability can be added to nearly any application.

    When asynchronous responses are driven by the server, the state need not be maintained continuously -- it can be lazily constructed from the database just for that response. Asynchronous Servlet features allow us to do this with a bounded number of threads (are thousands of threads really feasible on current operating systems?).
    Right, but you're not a webapp developer. What I meant is that webapp developers should not be using the Servlet API features, but instead rely on higher level features presented by frameworks (such as your framework). As a result, I cannot set any business that the Servlet API 3.0 would have trying to add shortcuts for fancy handling of specific content, or high level constructs like (real, hopefully) continuations.
  24. The problem with the low-level-APIs-are-more-flexible argument is that it's logical extension is to simply provide a HTTP parser and generator and let the frameworks program directly to NIO. I'm certain that there are much better APIs for asynchronous HTTP handling than what I have proposed. If we were working from green fields, then we could do a lot better. However, these APIs would not be Servlet APIs. The intent is not simply to allow new code to be written that will work asynchronously, but to allow the huge amount of existing frameworks and apps to be reused while accessing asynchronous features. For example filters that implement private authentication and authorization policies may need to be used and might not be quick to update. So an async mechanism that works within the service call chain will allow these to be reused. Or existing frameworks/apps can be used to generate content after a filter has performed some asynchronous delays ONLY IF the async features call the standard service method. Finally, my proposal does support new ContentConverter APIs that would allow a framework to do arbitrary async handling. Because this is new API, I see no reason that it needs to pretend to be a Servlet. But I do see value in allowing 3.0 servlets to handle the produce of these new APIs in the familiar blocking application environment of the ServletContext. More over, I see value in container supplied converters so that every framework does not need to provide its own async file upload handling and async XML parser and async JSON parser etc. etc.
  25. The most sensible solution, assuming there's a real demand, is to provide a low level event based non blocking API, which would allow building any sort of higher level constructs on top of it (like content producers and "continuations"). These constructs would be defined in frameworks (Seam, etc).
    Imho that sounds good. Is there a public proposal for something like you have in mind?
    The real question is if users need to be exposed to async functionality at all.
    There's definitively demand for standardized support for async functionality. Frameworks would benefit from talking to servlet API interfaces/ classes instead of container specific classes, and in the end of the day, you want to give people the option to do without frameworks (but container independent) as well if you ask me.