Tomcat vs Jetty vs Wildfly runtime comparision
Apache Tomcat™ is an open source software implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are developed under the Java Community Process.
Jetty is a Java HTTP (Web) server and Java Servlet container. While Web Servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks.
WildFly is a flexible, lightweight, managed application runtime from Jboss
Note: Application Servers offers several aspects (Startup Time, Memory footprint, Admin console, JEE Certification, Simpler Upgrades, Community support, Enterprise support, Security, CDN for static content, Integration with IDEs etc)which determines the right server for a typical use-case, but the most important aspect is your team skills and run-ability of the your app on the server.
For this blog, first I’m only going to deploy the latest version of these 3 java servers and monitor their memory and cpu stats for an hour on same hardware/VM. Second will deploy a simple webapp which uses spring and H2 DB to see how these servers stats changes with workload, do they activate some modules later etc.
Step #1 Deploying Tomcat, Jetty & Wildfly with default settings
Here is my compose template, this deploys tomcat with its default root, example, doc apps, jetty doesn’t have anything by default, wildfly also ships with its root app.
As you can see Jetty takes the least memory 50MB compared to Tomcat taking 150MB and Wildfly taking 251MB.
Step #2 Deploying Tomcat, Jetty & Wildfly with a basic spring + h2 db app
Conclusion: After deploying a spring based web-app all the servers consume a almost same amount of memory, there is not much difference left now.
The blueprints used for deployment are here https://www.dchq.io/#/library/2c918010507e71630150883b976d5dcb