Comparison of Jetty and Tomcat
Same point:
1. Tomcat and jetty are both servlet engines that support standard servlet specifications and Java EE specifications.
Different points:
1. Architecture Comparison
Jetty's architecture is simpler than Tomcat's
The architecture of Jetty is based on handler, and the main extension functions can be implemented with handler, and the extension is simple.
The tomcat architecture is based on container design, and scaling is needed to understand the overall design structure of tomcat and not be scalable.
2. Performance comparison
There is little difference in jetty and Tomcat performance
Jetty can handle a large number of connections at the same time and can stay connected for a long time, suitable for web chat applications, and so on.
Jetty's architecture is simple, so as a server, jetty can load components on demand, reduce unwanted components, reduce server memory overhead, and improve server performance.
Jetty by default NiO end in processing I/O requests more dominant, in processing static resources, high performance
Tomcat is fit to handle a handful of very busy links, which means that Tomcat's overall performance is higher when the link life cycle is short.
Tomcat defaults to using bio to process I/O requests and is less performance when dealing with static resources.
3. Other comparisons
The application of jetty is faster, the modification is simple, and the support to the new servlet specification is better.
Tomcat is currently widely used, with more comprehensive support for Java EE and servlet, with many features directly integrated.
Jetty Startup and shutdown
Start with cmd command
Start jetty command: Java-jar Start.jar
Start.jar The following is the argument passed to Start.jar, with multiple arguments separated by spaces.
Parameter content can have the following:
--help View Help information
--stop Stop the service, the next section will talk about
--version View current Jetty version information
Other: As Jetty service profile
We see the previous command specifying the parameter content as Etc/jetty.xml, which actually points to a service profile that is used to set up the system configuration information for the jetty service startup. such as listening ports, publishing Web applications under a directory, Jndi configuration, and so on, are described in detail in subsequent chapters. Of course, the service profile can be multiple, such as:
Java-jar Start.jar Etc/jetty.xml Etc/jetty-plus.xml
This command specifies two service profiles, Etc/jetty.xml and Etc/jetty-plus.xml.
In subsequent chapters, the term "service profile" refers to these files.
Using the browser to open the address http://localhost:8080/, you will see the default example site for jetty.
If you can access http://localhost:8080 instructions jetty start successfully.