BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Jetty 6: Rewritten for Continuations, NIO, Servlet 2.5

Jetty 6: Rewritten for Continuations, NIO, Servlet 2.5

Bookmarks
The Jetty team released version 6 a couple of weeks ago and has also just released version 6.0.1 of the open-source web container. The Jetty 6 code base is a complete rewrite adding such features as Continuations, NIO support, and 2.5 Servlet spec compliance. InfoQ caught up with Jetty lead Greg Wilkins to find out more details on the version 6 product.

Jetty 6 is a complete re-write, "adding non-blocking without rearchitecting could be done (and was done to jetty 5), but without architectural change non-blocking cost more than it gained." Greg said.   "[It is like a house] ... You try and clean up every so often, but the clutter wins. Finally you give up and move to a new house."

On the new base, many new features have been added, such as Continuations.  The cometd implementation and DWR/ActiveMQ integration are both based on continuations. Integrations are key to Jetty with work being done in respect to Spring, Geronimo, Glassfish, and others. The new architecture made adding new features possible with less volitility to the code base. Finally Wilkins noted that the new buffering abstraction is rather key, allowing Jetty to be deployed in byte[] only environments as well as with the lastest JVM's supporting more advanced buffers.

On Jetty's use of NIO in version 6:

Above the connection layer, Jetty is designed as a non-blocking HTTP parser and generator. This has allowed us to use NIO selectors as a non-blocking scheduler.

But moreover, the rearchitecture has allowed us to use more of the NIO features. Our buffering abstraction allows direct buffer and file mapped buffers to be used when available and when appropriate. We can use gather writes, to send a header, content and trailer in a single NIO call.

But it is important to realize that we are not NIO dependant and that the new architecture should work equally as well on other IO frameworks: existing or future.

Continuations play a big part in the new server, as Greg had suggested in the past that they solve the needs of modern web 2.0 scalability

...continuations are a reflection that the needs of scalable web 2.0 cannot be met with the current servlet API.

It has always been a challenge to blend the event driven nature of protocols with the desire for procedural application environments. Continuations are a key mechanism for achieving this and Jetty continuations are a subset of a general continuation targeted specifically at suspending and resuming a HTTP request handler.

Suspend and resume are important in web 2.0, because the request handler is often forced to wait: wait for an event to send to the client (eg google chat); wait for a remote WS; wait for JDBC connection; etc.

With web 1.0, most of the waiting was done in the client or in the TCP connector. With web 2.0, most of the waiting is done within the servlet container. Without finding a cheap way to park requests from within the servlet container, web 2.0 can decrease scalability 10 fold.

With Jetty 6 continuations, we have been able to test to 10k simultaneous requests within the servlet container and we have web 2.0 applications that need this.

Wilkins talks a lot about Web 2.0 and believes that it is more than a technical issue:

Web 2.0 developers are pushing the envelope to develop the best, worst and wierdest UIs possible with the HTTP, HTML, javascript and DOM tools we have available.

The jetty community embraces that exploration of the possible. The response from some other projects to the issues of web 2.0 has been "That's protocol abuse. Don't do it!". But if you come to the Jetty community with a problem that your web 2.0 app is giving you, we will listen, learn and try to adapt. If you want to do it, we want you to do it with Jetty.

Finally we asked about Wilkins about his new company Webtide. He explained the the company allows them to provide 24x7 commercial support, training, and consulting for Jetty and web 2.0 applications. They also have an extended network of OS developers that allows Webtide to cross support a wide range of technologies. The upcoming Hightide Jetty extension will be the first release from the Webtide initiative.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Jetty

    by Cameron Purdy,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I've long been impressed with the care that goes into Jetty. You can tell it is loved.

    We're already doing testing on Jetty6 to ensure compatibility, and I'm looking forward to seeing the results.

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid

  • Jetty

    by Pete the Wheat,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    We're using Jetty 6.x and the maven-jetty-plugin 6.x and it works superb for our purposes.

    Great work, Jetty-team!

  • Jetty vs. Resin, Tomcat?

    by Floyd Marinescu,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I would love to see a performance comparison between Jetty, Resin, and Tomcat.

  • Hear more about Jetty Continuations at AjaxWorld next week

    by Greg Wilkins,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I will be speaking at AjaxWorld (3-4 October) in Santa Clara next week about Jetty continuations and I'll be at the OpenAjaxAlliance meeting following that. I'll also be speaking at The Ajax Experience in Boston later in the month and hope to cover more about cometd there.

    So if you have detailed questions... get me face to face!

  • Re: Jetty vs. Resin, Tomcat?

    by Greg Wilkins,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Benchmarking servlet containers has always been difficult and even more so with web 2.0. Measuring what I call "straight line speed", which is requests per second over a single connection is not realistic for most load profiles.

    We Jetty 6, we have concentrated on scaling issues other than straight line speed.

    For example, we can scale Jetty 6 to 10k simultaneous requests, which is something that most other containers simply can't do, but which is a key use-case for collaborative web 2.0 applications.

    Our small foot print will also have an effect, but probably only for large applications that will content for CPU cache space - unlike most benchmark apps.

    So my advice is benchmark your app with realistic load generators and I doubt you will have any complaints about Jetty. But if you do, we are definitely interested in hearing about it and what your load profile is like.

  • Congratulations!

    by Rod Johnson,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Congratulations to Greg and team! Jetty is a lean mean product, and I'm really pleased to see efforts to push the envelope regarding the Servlet spec.

    Btw I strongly urge anyone who uses Eclipse to try the Jetty Launcher: it's awesome and unbelievably fast.

  • Chat sample doesn't work on IE6

    by Gergely Nagyhazi,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Jetty is nice but ajax chat sample freeze on Internet explorer 6.
    Jetty 6 stable is out, but that bug is still exists.

  • Jetty Launcher

    by Kristoffer Teuber,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Anyone know what status the Jetty Launcher has regarding Jetty 6.0.1?
    It seems it does not recognize the new version.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT