What is a Tomcat

Java EE(Java Platform Enterprise Edition) is an open source Java Web application server that implements some of the technical specifications of Java EE. Examples include Java Servlets, Java Server Page, JSTL, and Java WebSocket. Java EE is a standard platform launched by Sun Company for enterprise-level applications. It defines a series of technical specifications for enterprise-level development. In addition to the above, there are EJB, Java Mail, JPA, JTA, JMS, etc., which all depend on the implementation of specific containers

  

Tomcat and Jetty both provide only the Servlet and JSP specifications required for Java Web containers. Developers need to rely on other open source implementations to implement the rest of the functionality.

Glassfish is introduced by Sun. After the latest Java EE specification comes out, Glassfish will be implemented first, so it is the first choice to study the latest Java EE technology.

The most common scenario is to use Tomcat as a Java Web server, using the power that Spring provides out of the box, and relying on other open source libraries to implement responsible business functions

Common tuning Method 1: Modify… /bin/catalina.sh(optimized on startup)

Under Windows to catalina. Bat

Add parameters:

Export JAVA_OPTS = “server”

Function: Tomcat runs in Java-client mode by default. Add server to switch Tomcat to production mode to support higher concurrency and throughput.

Test results:

Modify before:

  

Revised:

  

Conclusion:

The maximum concurrency and throughput have been significantly improved.

Common tuning Mode 2:

Add parameters:

Export JAVA_OPTS = “- server – Xms256M – Xmx256M”

The default value is 1/64 of the total physical memory and less than 1G(-xmx). The Xmx parameter indicates the maximum size of the heap. The value of this parameter on this machine is about 128mb. Here we double it. Normally this parameter should be set to the same value. There are other parameters, such as Xss, which represent stack memory per thread. The default is 1M, but a review of the data shows that these parameters generally do not need to be changed. Adding heap memory is the best and safest way to improve Tomcat memory performance.

Test results:

  

  

Conclusion:

Compared with the previous parameter, it is clear that the average value of concurrent requests has increased by 2-3 times, while the maximum and throughput rates have decreased. My guess is that the throughput rate dropped because it was pulled down by the increase in the number of concurrent requests per second at a given throughput. The decrease in the maximum concurrency and the increase in the average indicate that the system has improved its processing power and stability under this configuration.

Look at this and like it.