关于 Tomcat HTTP connector 的具体实现及使用

以 tomcat 8 为例, 有4个 http protocol 实现:

  1. org.apache.coyote.http11.Http11Protocol - blocking Java connector
  2. org.apache.coyote.http11.Http11NioProtocol - non blocking Java NIO connector
  3. org.apache.coyote.http11.Http11Nio2Protocol - non blocking Java NIO2 connector
  4. org.apache.coyote.http11.Http11AprProtocol - the APR/native connector.

如果配置里面没有设置这个 protocol 的值, 是有个自动选择机制:

Sets the protocol to handle incoming traffic. The default value is
HTTP/1.1 which uses an auto-switching mechanism to select either a non
blocking Java NIO based connector or an APR/native based connector. If
the PATH (Windows) or LD_LIBRARY_PATH (on most unix systems)
environment variables contain the Tomcat native library, the
APR/native connector will be used. If the native library cannot be
found, the non blocking Java based connector will be used. Note that
the APR/native connector has different settings for HTTPS than the
Java connectors.

nio 和 nio2 有什么区别?

Apr/native 是什么?

refer:
https://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Connector_Comparison

标签: none

添加新评论