k.APR通道特殊配置

时间:2023-12-17 13:24:38

APR/native specific configuration

The following attributes are specific to the APR/native connector.

Attribute Description
deferAccept

Sets the TCP_DEFER_ACCEPT flag on the listening socket for this connector. The default value is true where TCP_DEFER_ACCEPT is supported by the operating system, otherwise it is false.

TCP_DEFER_ACCEPT是一个socket优化的参数,在linux内核的比较新版本中提供支持,减少系统调用的次数,提升性能用的,是协议栈和内核级的一个参数。

pollerSize

Amount of sockets that the poller responsible for polling kept alive connections can hold at a given time. Extra connections will be closed right away. The default value is 8192, corresponding to 8192 keep-alive connections. This is a synonym for maxConnections.

poller线程同时能保持的alive connections的数目,最大就是8192,实际就是poller线程中维护的那个队列的大小,每一个队列元素就是一个poller项。

pollerThreadCount

Number of threads used to poll kept alive connections. On Windows the default is chosen so that the sockets managed by each thread is less than 1024. For Linux the default is 1. Changing the default on Windows is likely to have a negative performance impact.

poller线程数,windows是1024,linux是1.

pollTime

Duration of a poll call in microseconds. Lowering this value will slightly decrease latency of connections being kept alive in some cases, but will use more CPU as more poll calls are being made. The default value is 2000 (2ms).

可以理解为在poller线程中一个任务请求执行的最大的时间,减少这个属性值的设置可以减少poller线程中任务的执行延迟,会让cpu更多的进行执行,默认是2ms。

sendfileSize

Amount of sockets that the poller responsible for sending static files asynchronously can hold at a given time. Extra connections will be closed right away without any data being sent (resulting in a zero length file on the client side). Note that in most cases, sendfile is a call that will return right away (being taken care of "synchronously" by the kernel), and the sendfile poller will not be used, so the amount of static files which can be sent concurrently is much larger than the specified amount. The default value is 1024.

sendfile文件大小

sendfileThreadCount

Number of threads used service sendfile sockets. On Windows the default is chosen so that the sockets managed by each thread is less than 1024. For Linux the default is 1. Changing the default on Windows is likely to have a negative performance impact.

sendfile线程的个数。

threadPriority

(int)The priority of the acceptor and poller threads. The default value is 5 (the value of the java.lang.Thread.NORM_PRIORITY constant). See the JavaDoc for the java.lang.Thread class for more details on what this priority means.

这个是设置acceptor和poller的线程优先级,提高这两块的优先级,可以加大tomcat前端的执行力。

useComet

(bool)Whether to allow comet servlets or not. Default value is true.

异步cometsevlet

useSendfile

(bool)Use this attribute to enable or disable sendfile capability. The default value is true. Note that the use of sendfile will disable any compression that Tomcat may otherwise have performed on the response.

是否使用senfile属性