From: fhanik Date: Thu, 22 Feb 2007 20:11:50 +0000 (+0000) Subject: Add in configuration options to control the application buffers associated with a... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e9f2261d3e44fa31a7c9776bf0a8593304ab52c2;p=tomcat7.0 Add in configuration options to control the application buffers associated with a NioChannel git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@510639 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 7fc88c8c7..943de1eee 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -807,13 +807,13 @@ public class NioEndpoint { if (sslContext != null) { SSLEngine engine = createSSLEngine(); int appbufsize = engine.getSession().getApplicationBufferSize(); - NioBufferHandler bufhandler = new NioBufferHandler(Math.max(appbufsize,getReadBufSize()), - Math.max(appbufsize,getWriteBufSize()), + NioBufferHandler bufhandler = new NioBufferHandler(Math.max(appbufsize,socketProperties.getAppReadBufSize()), + Math.max(appbufsize,socketProperties.getAppWriteBufSize()), socketProperties.getDirectBuffer()); channel = new SecureNioChannel(socket, engine, bufhandler, selectorPool); } else { - NioBufferHandler bufhandler = new NioBufferHandler(getReadBufSize(), - getWriteBufSize(), + NioBufferHandler bufhandler = new NioBufferHandler(socketProperties.getAppReadBufSize(), + socketProperties.getAppWriteBufSize(), socketProperties.getDirectBuffer()); channel = new NioChannel(socket, bufhandler); diff --git a/java/org/apache/tomcat/util/net/SocketProperties.java b/java/org/apache/tomcat/util/net/SocketProperties.java index 8a2a72622..f7569d217 100644 --- a/java/org/apache/tomcat/util/net/SocketProperties.java +++ b/java/org/apache/tomcat/util/net/SocketProperties.java @@ -62,6 +62,18 @@ public class SocketProperties { protected int txBufSize = 43800; /** + * The application read buffer size in bytes. + * Default value is rxBufSize + */ + protected int appReadBufSize = rxBufSize; + + /** + * The application write buffer size in bytes + * Default value is txBufSize + */ + protected int appWriteBufSize = txBufSize; + + /** * NioChannel pool size for the endpoint, * this value is how many channels * -1 means unlimited cached, 0 means no cache @@ -223,6 +235,14 @@ public class SocketProperties { return properties; } + public int getAppReadBufSize() { + return appReadBufSize; + } + + public int getAppWriteBufSize() { + return appWriteBufSize; + } + public int getDirectBufferPool() { return bufferPool; } @@ -299,6 +319,14 @@ public class SocketProperties { this.keyCache = keyCache; } + public void setAppReadBufSize(int appReadBufSize) { + this.appReadBufSize = appReadBufSize; + } + + public void setAppWriteBufSize(int appWriteBufSize) { + this.appWriteBufSize = appWriteBufSize; + } + public void setDirectBufferPool(int directBufferPool) { this.bufferPool = directBufferPool; } diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml index f4e17ec4a..51e579859 100644 --- a/webapps/docs/config/http.xml +++ b/webapps/docs/config/http.xml @@ -404,6 +404,16 @@

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 + This attribute controls the size of these buffers. By default this read buffer is sized to match the + socket read buffer (SO_RCVBUF) value, but can be sized separately.

+
+ +

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 to match the + socket read buffer (SO_SNDBUF) value, but can be sized separately.

+

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.