Comparison and optimization of three operating modes (BIO, NIO, APR) of tomcatconne

Source: Internet
Author: User

Comparison and optimization of three operating modes (BIO, NIO, APR) of tomcatconne
The performance of three different running Modes of Tomcat ctor varies greatly. The results tested are as follows:
The differences between the three modes are as follows:
BIO:A thread processes a request. Disadvantage: High concurrency leads to a large number of threads, which wastes resources. Tomcat 7 or lower, which is used by default in Linux.
NIO:Java asynchronous IO processing allows a small number of threads to process a large number of requests.
Tomcat8 uses this method by default in Linux. Tomcat7 must modify Connector configuration to start:
APR:Apache Portable Runtime solves the io blocking problem from the operating system level.
Tomcat7 or Tomcat8 is enabled in Win7 or later systems by default. If apr and native are installed in Linux, Tomcat can directly start apr. (Installation: http://my.oschina.net/lsw90/blog/181161)
Java Blocking Java ctor 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
Polling Size N/A maxConnections
Read Request Headers Blocking Sim Blocking
Read Request Body Blocking Sim Blocking
Write Response Blocking Sim Blocking
Wait for next Request Blocking Non Blocking
Max Connections maxConnections
When Tomcat is started, you can view the running mode used by Connector through the log:
Starting ProtocolHandler ["http-bio-8080"]
Starting ProtocolHandler ["http-nio-8080"]
Starting ProtocolHandler ["http-apr-8080"]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.