Jetty VS Tomcat Performance Comparison

Jetty VS Tomcat Overview

Jetty and Tomcat are open servlet containers, both of them support HTTP server, HTTP client and javax.servlet container. In this article, we will quick view the difference between Jetty and Tomcat, and give the generic idea about which is the better one.

You may think it is not make sense to compare the two containers, tomcat is the one clearly discussed moreover than jetty, it supports a lot of wonderful options to developers, this is no doubt we start using tomcat throughout development because it’s easy-going and free, Its an foremost free application server and provided full web server functionality and can be stripped down to be embedded or built up an full J2EE server.

Jetty is a uniformly excellent tool about particularly feature. It has been started around since 1998 and claims to be a â€œ100% Java HTTP Server and Servlet Containerâ€. It is a foremost a set of software components that offer HTTP and servlet services. Jetty can be installed as a standalone application server or be easily embedded in an application or framework as a HTTP component. It is a simple servlet engine, as do a feature rich servlet engine or as do part of a full JEE environment.

Letâ€™s take a look: Jetty VS Tomcat:

Popularity:

The following figure gives us a generic idea about which Java Containers / App Servers are used the most?
The results came from more than 1000+ developers survey, they reported what the container they are in use in enterprise production, for those participantsÂ they don’t use them now, they can choose what container they ever used or what they expect to be best. From the figure we can also see that Tomcat and Jetty are bigger winner open source containers. Tomcat Â is the absolute primary containerÂ over all others.

Your “benchmark” is flawed in many ways; Peter suggested one, but there are other flaws.
You think Google would have chosen Jetty if it’s twice as slow as Tomcat ?
Perhaps they made serious benchmarks and it turned out they got different results.

So if Google chooses Jetty, than that means the test results are by default erroneous? maybe Google are just plain stupid in their Jetty choice or maybe it has to do with political reasons or maybe Google tweaked their hardware so jetty could be happy. Who knows… These little tests have shown Jetty is the clear loser I’d say.

Thank your comments. Jetty and Tomcat both have Strong Tools, Application, Devices and Cloud computing supported. For this case I just did single test on them and it reported Tomcat presented better than Jetty. I think there should have some optimization option which didn’t enableed. My case ran on Window Ubuntu/JDK6/2G RAM.

While this whole test is pretty flawed it does give on valuable insight: no matter which container you choose, processing a full request cycle in 1 or 2 ms is pretty much negligible compared to typical response times in the 3 digit numbers.

PS: and what’s the number crunching for? The chosen container certainly won’t have an influence on that code.

Testing anything with the defaults is strange because you are not sure which features are on and off by default. Also default settings are typically made to work is small memory low CPU environments. Not great for showing how well something truly performs.

In my own benchmark tests, Tomcat has much better raw performance for short bursts of traffic. The problem with Tomcat is that it uses a lot more memory than Jetty. What ends up happening is that Tomcat ends up choking itself because of garbage collection.

If this guy ran his benchmark for 20 minutes, he would see Jetty take over in performance. Jetty is kind of like the tortoise in the classic story of “The Tortoise and the Hare”. It conserves its resources for sustainable, consistent, and reliable performance. Tomcat uses as much resources as it can until the system literally runs out.

I’ve done tests with 100 concurrent connections pounding the server and Jetty maintains a 0% error rate after 1 hour whereas Tomcat will have a 30% error rate in the same amount of time.

Garbage collecting can be seriously tweaked by assigning a few arguments to your JVM. That should not be an issue. If jetty uses less memory it means it does less or needs to star reading code from elsewhere when specific things are required…. It is as simple as that. I’m sure the tomcat developers – after 20 or more years – know their business… No offense intended.

No offense, if you speak of 30% error rate while jetty has 0%, don’t take me wrong please but i do not believe you. i have a Tomcat 7.0.42 on my Mac, not even running APR and it spins like a kitten. Responses are very fast and no errors at all….. Server has 16GB of ram and tomcat gets 2 gigs. Machine is an i5 3.1Ghz

I’ve only just found this… It’s very very interesting… Good work!
Of course Tomcat is just a servlet container, where Jetty is more or less a full app server.
But, nowadays the vast majority of enterprise apps are constructed using pojo frameworks like Spring that make no use of app server functionality.
I have been saying for years, that if you don’t need a container.. use Tomcat
But people keep buying Weblogic (Not that there’s anything wrong with Weblogic, I like it) it’s just that for apps that don’t use a container, Tomcat is the right choice.
I’m not affiliated in any way to the Tomcat project.

There is one other argument, which is that Glassfish is an OSGi container. That gives it something that neither Tomcat nor Jetty have.