Jetty and tomcat are both open source Servlet containers.
2. Differences:
Tomcat is the first generation of open source Servlet container with relatively old architecture and the largest number of users. Jetty is relatively more reasonable and faster.
1.Choice of Jetty and Tomcat: According to different scenes, Jetty is lighter. This is relative to Tomcat.
2. Because Tomcat not only follows the Java Servlet specification, but also extends many JEE features to meet the needs of enterprise applications, Tomcat is a heavyweight and its configuration is much more complicated than Jetty's. But for a large number of ordinary Internet applications, other advanced features of Tomcat are not needed, so in this case, using Tomcat is a waste of resources. This shortcoming is more obvious in distributed environment. Switching to Jetty saves several megabytes of memory per application server, which saves a lot of resources for a large distributed environment. In addition, Jetty's lightweight also makes it faster and more efficient when dealing with high concurrent fine-grained requests. Jetty is more flexible, which is reflected in its pluggability and expansibility. It is easier for developers to redevelop Jetty itself and customize a Web server that suits their own needs.
3. In contrast, the heavyweight Tomcat originally supported too many functions, and the cost of slimming it is far greater than the cost of enriching Jetty. In my own understanding, it is easier to gain weight than to lose weight.
4. However, when supporting large enterprise applications, Jetty may need to be extended, and Tomcat is better in this scenario. 5. Summary: Jetty is more suitable for the distributed environment of public cloud, and Tomcat is more suitable for the enterprise environment.