172

I'm wondering about the downsides of each servers in respect to a production environment. Did anyone have big problems with one of the features? Performance, etc. I also quickly took a look at the new Glassfish, does it match up the simple servlet containers (it seems to have a good management interface at least)?

Faheem Mitha
  • 6,096
  • 7
  • 48
  • 83
Loki
  • 29,950
  • 9
  • 48
  • 62
  • 3
    Even if this question is very old, I just saw it today. Talking about production environments, I would like to add that Google chose Jetty for Google App Engine. http://www.infoq.com/news/2009/08/google-chose-jetty – stivlo Jul 17 '11 at 18:17
  • 1
    Someone nominated this for reopening, but it's an opinion-based discussion question. Maybe a historical lock would be appropriate, but I can't see reopening this. – Adi Inbar Apr 27 '14 at 20:58
  • I had experience by using Tomcat as Socket Server but in the end I choose to use Jetty. The server, in this particularly case, easier to set up and well documented. – Kaira Mar 01 '18 at 14:14

3 Answers3

83

I love Jetty for its low maintenance cost. It's just unpack and it's ready to roll. Tomcat is a bit high maintenance, requires more configuration and it's heavier. Besides, Jetty's continuations are very cool.

EDIT: In 2013, there are reports that Tomcat has gotten easier. See comments. I haven't verified that.

Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373
  • 12
    This doesn't answer the question especially for performance. I wouldn't mind messing around with configuration more if it meant better performance. – John Sep 16 '10 at 16:46
  • 4
    @John: I haven't had performance problems with neither, else I would have mentioned it. I have a *feeling* that Jetty is faster, but haven't had the need to prove it. – Vinko Vrsalovic Sep 16 '10 at 19:07
  • 4
    Tomcat is also only about unpacking and running it. – frandevel Feb 07 '13 at 14:03
  • 2
    This does not look very true for me, Tomcat also runs out of box. – Audrius Meškauskas Feb 09 '13 at 19:26
  • @AudriusMeskauskas what do you mean? Would you please provide a real scenario as of 2020 :). Thanks. – Dedyshka Apr 19 '20 at 10:11
  • as of 2020 I think [Spring Boot](https://spring.io/guides/gs/spring-boot/) should be used for new projects. – Audrius Meškauskas Apr 19 '20 at 12:39
  • so Jetty is not event driven asynchronous like nginx?.. does it also use the same thread per request model of tomcat? – rogue-one Jun 16 '20 at 22:50
  • As of 2022, the jetty is more performant than the tomcat. There is no easier way to configure your custom thread pool implementation in tomcat but jetty. It's too easy to configure custom thread pool implementation in the jetty. That is important for creating a virtual thread per request. I think spring should replace tomcat with jetty in spring-boot-starter-web dependency. – ashikuzzaman May 26 '22 at 08:08
18

I think tomcat is more disscussed and supported by application, Jetty is portable and can be embedded in an application. and Jetty has good continuations.

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
Jimmy Subb
  • 181
  • 1
  • 2
5

I like how Jetty can be embedded in an application so that it doesn't need to run in a web container (Hudson and Nexus are two apps that can run in this mode). Can Tomcat do this?

Andrew Swan
  • 13,427
  • 22
  • 69
  • 98
  • 34
    Of course it can – ggarber Mar 16 '10 at 15:54
  • 5
    there is an embedded tomcat too – F.O.O Dec 11 '15 at 22:09
  • 1
    To be more precise: embedding Tomcat has been possible for over a decade, but it became a lot easier with Tomcat 7.x in 2011. There is no real difference in complexity compared to Jetty. See e.g. http://arhipov.blogspot.com/2011/03/embedded-tomcat-minimal-version.html or https://www.hascode.com/2013/07/embedding-jetty-or-tomcat-in-your-java-application/ – winne2 Jun 11 '18 at 12:20
  • Definately its can be done with maven too. There's a maven plugin. https://metamug.com/article/generate-build-run-webapp-maven-command-line-tomcat.html – Sorter Jan 17 '19 at 12:30
  • 2
    If I am not wrong , the spring boot comes with an embedded tomcat for a web application and just runs as a standalone application so we can quickly launch GUI without the need to deploy on any external web server. – Stunner Jul 28 '20 at 08:44