From 5b6f8ccafadb462b12d57f336ce5dbd0811307a6 Mon Sep 17 00:00:00 2001 From: fhanik Date: Thu, 22 Mar 2007 22:33:16 +0000 Subject: [PATCH] documented the useSendfile behavior for NIO git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@521509 13f79535-47bb-0310-9956-ffa450edef68 --- webapps/docs/aio.xml | 2 +- webapps/docs/config/http.xml | 72 ++++++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/webapps/docs/aio.xml b/webapps/docs/aio.xml index 98c8da180..d3e039df4 100644 --- a/webapps/docs/aio.xml +++ b/webapps/docs/aio.xml @@ -266,7 +266,7 @@ public class ChatServlet

- When APR is enabled, Tomcat supports using sendfile to send large static files. + When APR or NIO is enabled, Tomcat supports using sendfile to send large static files. These writes, as soon as the system load increases, will be performed asynchronously in the most efficient way. Instead of sending a large response using blocking writes, it is possible to write content to a static file, and write it diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml index 83bc0d76e..a7117d7f0 100644 --- a/webapps/docs/config/http.xml +++ b/webapps/docs/config/http.xml @@ -403,8 +403,13 @@ the -Djava.net.preferIPv4Stack=true value to your command line

+ +

(bool)Use this attribute to enable or disable sendfile capability. + The default value is true +

+
-

Set to true to use the NIO thread pool executor. The default value is true. +

(bool)Set to true to use the NIO thread pool executor. The default value is true. If set to false, it uses a thread pool based on a stack for its execution. Generally, using the executor yields a little bit slower performance, but yields a better fairness for processing connections in a high load environment as the traffic gets queued through a @@ -414,23 +419,23 @@

-

The number of threads to be used to accept connections. Increase this value on a multi CPU machine, +

(int)The number of threads to be used to accept connections. Increase this value on a multi CPU machine, although you would never really need more than 2. Also, with a lot of non keep alive connections, you might want to increase this value as well. Default value is 1.

-

The number of threads to be used to run for the polling events. Default value is 1. +

(int)The number of threads to be used to run for the polling events. Default value is 1. Can't see a reason to go above that. But experiment and find your own results.

-

The priority of the poller threads. +

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

-

The priority of the acceptor threads. The threads used to accept new connections. +

(int)The priority of the acceptor threads. The threads used to accept new connections. The default value is java.lang.Thread#NORM_PRIORITY. See the JavaDoc for the java.lang.Thread class for more details on what this priority means. @@ -438,117 +443,120 @@ -

The time in milliseconds to timeout on a select() for the poller. +

(int)The time in milliseconds to timeout on a select() for the poller. This value is important, since connection clean up is done on the same thread, so dont set this value to an extremely high one.

-

Whether to allow comet servlets or not, Default value is true.

+

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

-

Boolean value, whether to use direct ByteBuffers or java mapped ByteBuffers. Default is false +

(bool)Boolean value, whether to use direct ByteBuffers or java mapped ByteBuffers. Default is false
When you are using direct buffers, make sure you allocate the appropriate amount of memory for the direct memory space. On Sun's JDK that would be something like -XX:MaxDirectMemorySize=256m

-

The socket receive buffer (SO_RCVBUF) size in bytes. Default value is 25188

+

(int)The socket receive buffer (SO_RCVBUF) size in bytes. Default value is 25188

-

The socket send buffer (SO_SNDBUF) size in bytes. Default value is 43800

+

(int)The socket send buffer (SO_SNDBUF) size in bytes. Default value is 43800

-

Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer +

(int)Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer This attribute controls the size of these buffers. By default this read buffer is sized at 8192 bytes. For lower concurrency, you can increase this to buffer more data. For an extreme amount of keep alive connections, decrease this number or increase your heap size.

-

Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer +

(int)Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer This attribute controls the size of these buffers. By default this write buffer is sized at 8192 bytes. For low concurrency you can increase this to buffer more response data. - For an extreme amount of keep alive connections, decrease this number or increase your heap size.

+ For an extreme amount of keep alive connections, decrease this number or increase your heap size. +
+ The default value here is pretty low, you should up it if you are not dealing with tens of thousands + concurrent connections.

-

The Nio connector uses a class called NioChannel that holds elements linked to a socket. +

(int)The Nio connector uses a class called NioChannel that holds elements linked to a socket. To reduce garbage collection, the Nio connector caches these channel objects. This value specifies the size of this cache. The default value is 500, and represents that the cache will hold 500 NioChannel objects. Other values are -1. unlimited cache, and 0, no cache.

-

The NioChannel pool can also be size based, not used object based. The size is calculated as follows:
+

(int)The NioChannel pool can also be size based, not used object based. The size is calculated as follows:
NioChannel buffer size = read buffer size + write buffer size
SecureNioChannel buffer size = application read buffer size + application write buffer size + network read buffer size + network write buffer size
The value is in bytes, the default value is 1024*1024*100 (100MB)

-

Tomcat will cache SocketProcessor objects to reduce garbage collection. +

(int)Tomcat will cache SocketProcessor objects to reduce garbage collection. The integer value specifies how many objects to keep in the cache at most. The default is 500. Other values are -1. unlimited cache, and 0, no cache.

-

Tomcat will cache KeyAttachment objects to reduce garbage collection. +

(int)Tomcat will cache KeyAttachment objects to reduce garbage collection. The integer value specifies how many objects to keep in the cache at most. The default is 500. Other values are -1. unlimited cache, and 0, no cache.

-

Tomcat will cache PollerEvent objects to reduce garbage collection. +

(int)Tomcat will cache PollerEvent objects to reduce garbage collection. The integer value specifies how many objects to keep in the cache at most. The default is 500. Other values are -1. unlimited cache, and 0, no cache.

-

same as the standard setting tcpNoDelay. Default value is false

+

(bool)same as the standard setting tcpNoDelay. Default value is false

-

Boolean value for the socket's keep alive setting (SO_KEEPALIVE). Default is false.

+

(bool)Boolean value for the socket's keep alive setting (SO_KEEPALIVE). Default is false.

-

Boolean value for the socket OOBINLINE setting. Default value is true

+

(bool)Boolean value for the socket OOBINLINE setting. Default value is true

-

Boolean value for the sockets reuse address option (SO_REUSEADDR). Default value is true

+

(bool)Boolean value for the sockets reuse address option (SO_REUSEADDR). Default value is true

-

Boolean value for the sockets so linger option (SO_LINGER). Default value is true. +

(bool)Boolean value for the sockets so linger option (SO_LINGER). Default value is true. This option is paired with the soLingerTime value.

-

Value in seconds for the sockets so linger option (SO_LINGER). Default value is 25 seconds. +

(bool)Value in seconds for the sockets so linger option (SO_LINGER). Default value is 25 seconds. This option is paired with the soLinger value.

-

Value in milliseconds for the sockets read timeout (SO_TIMEOUT). Default value is 5000 milliseconds.

+

(int)Value in milliseconds for the sockets read timeout (SO_TIMEOUT). Default value is 5000 milliseconds.

-

Value between 0 and 255 for the traffic class on the socket, 0x04 | 0x08 | 0x010

+

(byte)Value between 0 and 255 for the traffic class on the socket, 0x04 | 0x08 | 0x010

-

The first value for the performance settings. Default is 1, see Socket Performance Options

+

(int)The first value for the performance settings. Default is 1, see Socket Performance Options

-

The second value for the performance settings. Default is 0, see Socket Performance Options

+

(int)The second value for the performance settings. Default is 0, see Socket Performance Options

-

The third value for the performance settings. Default is 1, see Socket Performance Options

+

(int)The third value for the performance settings. Default is 1, see Socket Performance Options

-

The max selectors to be used in the pool, to reduce selector contention. +

(int)The max selectors to be used in the pool, to reduce selector contention. Use this option when the command line o.a.t.u.net.NioSelectorShared value is set to false. Default value is 200.

-

The max spare selectors to be used in the pool, to reduce selector contention. +

(int)The max spare selectors to be used in the pool, to reduce selector contention. When a selector is returned to the pool, the system can decide to keep it or let it be GC:ed. Use this option when the command line o.a.t.u.net.NioSelectorShared value is set to false. Default value is -1 (unlimited)

The following command line options are available for the NIO connector:
- -Dorg.apache.tomcat.util.net.NioSelectorShared=true|false - default is true. + -Dorg.apache.tomcat.util.net.NioSelectorShared=true|false - default is true. Set this value to false if you wish to use a selector for each thread. the property. If you do set it to false, you can control the size of the pool of selectors by using the selectorPool.maxSelectors attribute

-- 2.11.0