InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Jetty 6: Rewritten for Continuations, NIO, Servlet 2.5

Posted by Scott Delap on Sep 28, 2006

Sections
Development,
Operations & Infrastructure
Topics
Application Servers ,
Java
Tags
Jetty ,
Continuations
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.

Jetty by Cameron Purdy Posted
Jetty by Pete the Wheat Posted
Jetty vs. Resin, Tomcat? by Floyd Marinescu Posted
Re: Jetty vs. Resin, Tomcat? by Greg Wilkins Posted
Hear more about Jetty Continuations at AjaxWorld next week by Greg Wilkins Posted
Congratulations! by Rod Johnson Posted
Jetty Launcher by Kristoffer Teuber Posted
Chat sample doesn't work on IE6 by Gergely Nagyhazi Posted
  1. Back to top

    Jetty

    by Cameron Purdy

    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

  2. Back to top

    Jetty

    by Pete the Wheat

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

    Great work, Jetty-team!

  3. Back to top

    Jetty vs. Resin, Tomcat?

    by Floyd Marinescu

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

  4. Back to top

    Hear more about Jetty Continuations at AjaxWorld next week

    by Greg Wilkins

    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!

  5. Back to top

    Re: Jetty vs. Resin, Tomcat?

    by Greg Wilkins

    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.

  6. Back to top

    Congratulations!

    by Rod Johnson

    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.

  7. Back to top

    Chat sample doesn't work on IE6

    by Gergely Nagyhazi

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

  8. Back to top

    Jetty Launcher

    by Kristoffer Teuber

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

Educational Content

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.

Beauty Is in the Eye of the Beholder

Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.

Architecting Visa for Massive Scale and Continuous Innovation

John Davies examines Visa’s architecture and shows how enterprises have architected complex integrations incorporating Hadoop, memcached, Ruby on Rails, and others to deliver innovative solutions.

Max Protect: Scalability and Caching at ESPN.com

Sean Comerford unveils ESPN.com’s architecture, what components are used and why, and the current changes the website goes through.

The Seven Deadly Sins of Enterprise Agile Adoption

Are there repeated patterns of failure on Enterprise Agile Enablement efforts? Sanjiv and Arlen discuss Seven Deadly Sins to avoid when adopting Agile in an enterprise.