Tomcat starts with version 5.5 and supports the following four types of connector configurations, respectively:
<connector port= "8081" protocol= "org.apache.coyote.http11.Http11NioProtocol" Connectiontimeou t= "20000" redirectport= "8443"/>
<connector port= "8081" protocol= "http/1.1" connectiontimeout= "20000"
Redirectport= "8443"/>
<connector executor= "tomcatthreadpool"
port= "8081" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443"/>
<connector executor= "tomcatthreadpool"
port= "8081" protocol= "org.apache.coyote.http11.Http11NioProtocol"
connectiontimeout= "20000"
Redirectport= "8443"/>
Let's just name the above four connector in the order of NIO, HTTP, POOL, NIOP
In order not to let other factors affect the test results, we only test a very simple JSP page, and this page simply outputs a Hello World. Assuming the address is http://tomcat1/test.jsp
We test four kinds of connector in turn, the test client on another machine with the AB command to complete, Test command is: ab-c 900-n http://tomcat1/test.jsp, The final test results as shown in the table (unit: Average number of requests processed per second):
NIO HTTP POOL Niop
281 |
65 |
208 |
365 |
666 |
66 |
110 |
398 |
692 |
65 |
66 |
263 |
256 |
63 |
94 |
459 |
440 |
67 |
145 |
363 |
It is easy to see from these five sets that HTTP performance is stable, but it is the worst, and this is the default configuration for Tomcat. NiO is very volatile, but no less than 280, NIOP is on the basis of NIO to join the thread pool, it is possible that the program processing more complex, so the performance is not better than nio, and the pool mode is very volatile, the test period and the same as the http, and occasionally stalled.
Because the Linux kernel default limits the maximum number of open files is 1024, so this concurrency control at 900.
Although this results in the actual site because of various factors, may not be so different, such as limited by the performance of the database and so On. But it's also valuable to us when deploying Web Applications.
From: http://www.javayou.com/diary/143691518
Tomcat's four connector performance comparisons based on HTTP protocol