The three different modes of operation of TOMCAT connector vary widely, with the results being tested as follows:
The differences between the three modes are as follows:
A thread processes a request. Disadvantage: When the concurrency is high, the number of threads is much, wasting resources. TOMCAT7 or below, this method is used by default in Linux systems.
With Java's asynchronous IO processing, a large number of requests can be processed through a small number of threads.
Tomcat8 is used this way by default in Linux systems. TOMCAT7 must modify the connector configuration to start: <connector port= "8080" protocol= "Org.apache.coyote.http11.Http11NioProtocol " connectiontimeout= "20000" redirectport= "8443"/>
thatApache Portable Runtime, addressed from the OS levelioblocking issues.
Tomcat7 or TOMCAT8 is started by default in Win7 or more systems in this way. Linux supports Apr if the APR is installed and Native,tomcat is launched directly. (Installation method: http://my.oschina.net/lsw90/blog/181161)
The official details of the three differences are as follows:java Blocking Connector java Nio Blocking Connector apr/native Connector
BIO NIO APR
Classname ajpprotocol ajpnioprotocol ajpaprprotocol
Tomcat Version 3.x onwards 7.x onwards 5.5.x onwards
Support Polling NO Yes Yes
Polling Size N/a maxconnections maxconnections
Read Request Headers Blocking Sim Blocking Blocking
Read Request Body Blocking Sim Blocking Blocking
Write Response Blocking Sim Blocking Blocking
Wait for next Request Blocking Non Blocking Non Blocking
Max Connections maxconnections maxconnections maxconnections
When Tomcat starts, you can see in log which mode of Operation Connector is using:
- Starting Protocolhandler ["http-bio-8080"]
- Starting Protocolhandler ["http-nio-8080"]
- Starting Protocolhandler ["http-Apr-8080"]
(original article, reprint please specify the CSDN blog from Clement-xu)
Copyright NOTICE: This article is the original article, reprint please indicate the CSDN blog which is transferred from Clement-xu.
Tomcat connector comparison and optimization of three operating modes (BIO, NIO, APR)