Class SocketProperties
java.lang.Object
org.apache.tomcat.util.net.SocketProperties
Properties that can be set in the <Connector> element
in server.xml. All properties are prefixed with "socket."
and are currently only working for the Nio connector
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe application read buffer size in bytes.protected intThe application write buffer size in bytes Default value is txBufSizeprotected intNioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500 TODO: The default should be changed in Tomcat 10, actually it should be bufferPoolSize / (appReadBufSize + appWriteBufSize), assuming the SSL buffers are ignored (that would be logical), and the value would be 6400.protected intBuffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes) TODO: The default value to be used could rather be based on the JVM max heap, otherwise it could be a problem in some environments.protected booleanEnable/disable direct buffers for the network buffers Default value is disabledprotected booleanEnable/disable direct buffers for the network buffers for SSL Default value is disabledprotected intEnable/disable poller event cache, this bounded cache stores PollerEvent objects to reduce GC for the poller Default is 500 -1 is unlimited 0 is disabled >0 the max number of objects to keep in cache.protected BooleanOOBINLINE option.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected intEnable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled TODO: The default will be changed to 0 in Tomcat 10protected IntegerSocket receive buffer size in bytes (SO_RCVBUF).protected BooleanSO_KEEPALIVE option.protected BooleanSO_LINGER option, paired with thesoLingerTimevalue.protected IntegerSO_LINGER option, paired with thesoLingerOnvalue.protected BooleanSO_REUSEADDR option.protected IntegerSO_TIMEOUT option. default is 20000.protected BooleanTCP_NO_DELAY option.protected longThe minimum frequency of the timeout interval to avoid excess load from the poller during high trafficprotected IntegerSocket send buffer size in bytes (SO_SNDBUF).protected intTimeout in milliseconds for an unlock to take place. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintintbooleanintbooleanintbooleanintintintintintbooleanbooleanintbooleanintbooleanlongintintvoidsetAppReadBufSize(int appReadBufSize) voidsetAppWriteBufSize(int appWriteBufSize) voidsetBufferPool(int bufferPool) voidsetBufferPoolSize(int bufferPoolSize) voidsetDirectBuffer(boolean directBuffer) voidsetDirectBufferPool(int directBufferPool) voidsetDirectSslBuffer(boolean directSslBuffer) voidsetEventCache(int eventCache) voidsetOoBInline(boolean ooBInline) voidsetPerformanceBandwidth(int performanceBandwidth) voidsetPerformanceConnectionTime(int performanceConnectionTime) voidsetPerformanceLatency(int performanceLatency) voidsetProcessorCache(int processorCache) voidsetProperties(ServerSocket socket) voidsetProperties(Socket socket) voidvoidvoidsetRxBufSize(int rxBufSize) voidsetSoKeepAlive(boolean soKeepAlive) voidsetSoLingerOn(boolean soLingerOn) voidsetSoLingerTime(int soLingerTime) voidsetSoReuseAddress(boolean soReuseAddress) voidsetSoTimeout(int soTimeout) voidsetTcpNoDelay(boolean tcpNoDelay) voidsetTimeoutInterval(long timeoutInterval) voidsetTxBufSize(int txBufSize) voidsetUnlockTimeout(int unlockTimeout)
-
Field Details
-
processorCache
protected int processorCacheEnable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled TODO: The default will be changed to 0 in Tomcat 10 -
eventCache
protected int eventCacheEnable/disable poller event cache, this bounded cache stores PollerEvent objects to reduce GC for the poller Default is 500 -1 is unlimited 0 is disabled >0 the max number of objects to keep in cache. TODO: The default will be changed to 0 in Tomcat 10 -
directBuffer
protected boolean directBufferEnable/disable direct buffers for the network buffers Default value is disabled -
directSslBuffer
protected boolean directSslBufferEnable/disable direct buffers for the network buffers for SSL Default value is disabled -
rxBufSize
Socket receive buffer size in bytes (SO_RCVBUF). JVM default used if not set. -
txBufSize
Socket send buffer size in bytes (SO_SNDBUF). JVM default used if not set. -
appReadBufSize
protected int appReadBufSizeThe application read buffer size in bytes. Default value is rxBufSize -
appWriteBufSize
protected int appWriteBufSizeThe application write buffer size in bytes Default value is txBufSize -
bufferPool
protected int bufferPoolNioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500 TODO: The default should be changed in Tomcat 10, actually it should be bufferPoolSize / (appReadBufSize + appWriteBufSize), assuming the SSL buffers are ignored (that would be logical), and the value would be 6400. So the default value will be changed to a new default value like -2 to set a dynamic value based on bufferPoolSize in that case. -
bufferPoolSize
protected int bufferPoolSizeBuffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes) TODO: The default value to be used could rather be based on the JVM max heap, otherwise it could be a problem in some environments. Big servers also need to use a much higher default, while small cloud based ones should use 0 instead. Possible default value strategy: heap inf 1GB: 0 heap sup 1GB: heap / 32 -
tcpNoDelay
TCP_NO_DELAY option. JVM default used if not set. -
soKeepAlive
SO_KEEPALIVE option. JVM default used if not set. -
ooBInline
OOBINLINE option. JVM default used if not set. -
soReuseAddress
SO_REUSEADDR option. JVM default used if not set. -
soLingerOn
SO_LINGER option, paired with thesoLingerTimevalue. JVM defaults used unless both attributes are set. -
soLingerTime
SO_LINGER option, paired with thesoLingerOnvalue. JVM defaults used unless both attributes are set. -
soTimeout
SO_TIMEOUT option. default is 20000. -
performanceConnectionTime
Performance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used. -
performanceLatency
Performance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used. -
performanceBandwidth
Performance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used. -
timeoutInterval
protected long timeoutIntervalThe minimum frequency of the timeout interval to avoid excess load from the poller during high traffic -
unlockTimeout
protected int unlockTimeoutTimeout in milliseconds for an unlock to take place.
-
-
Constructor Details
-
SocketProperties
public SocketProperties()
-
-
Method Details
-
setProperties
- Throws:
SocketException
-
setProperties
- Throws:
SocketException
-
setProperties
- Throws:
IOException
-
setProperties
- Throws:
IOException
-
getDirectBuffer
public boolean getDirectBuffer() -
getDirectSslBuffer
public boolean getDirectSslBuffer() -
getOoBInline
public boolean getOoBInline() -
getPerformanceBandwidth
public int getPerformanceBandwidth() -
getPerformanceConnectionTime
public int getPerformanceConnectionTime() -
getPerformanceLatency
public int getPerformanceLatency() -
getRxBufSize
public int getRxBufSize() -
getSoKeepAlive
public boolean getSoKeepAlive() -
getSoLingerOn
public boolean getSoLingerOn() -
getSoLingerTime
public int getSoLingerTime() -
getSoReuseAddress
public boolean getSoReuseAddress() -
getSoTimeout
public int getSoTimeout() -
getTcpNoDelay
public boolean getTcpNoDelay() -
getTxBufSize
public int getTxBufSize() -
getBufferPool
public int getBufferPool() -
getBufferPoolSize
public int getBufferPoolSize() -
getEventCache
public int getEventCache() -
getAppReadBufSize
public int getAppReadBufSize() -
getAppWriteBufSize
public int getAppWriteBufSize() -
getProcessorCache
public int getProcessorCache() -
getTimeoutInterval
public long getTimeoutInterval() -
getDirectBufferPool
public int getDirectBufferPool() -
setPerformanceConnectionTime
public void setPerformanceConnectionTime(int performanceConnectionTime) -
setTxBufSize
public void setTxBufSize(int txBufSize) -
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay) -
setSoTimeout
public void setSoTimeout(int soTimeout) -
setSoReuseAddress
public void setSoReuseAddress(boolean soReuseAddress) -
setSoLingerTime
public void setSoLingerTime(int soLingerTime) -
setSoKeepAlive
public void setSoKeepAlive(boolean soKeepAlive) -
setRxBufSize
public void setRxBufSize(int rxBufSize) -
setPerformanceLatency
public void setPerformanceLatency(int performanceLatency) -
setPerformanceBandwidth
public void setPerformanceBandwidth(int performanceBandwidth) -
setOoBInline
public void setOoBInline(boolean ooBInline) -
setDirectBuffer
public void setDirectBuffer(boolean directBuffer) -
setDirectSslBuffer
public void setDirectSslBuffer(boolean directSslBuffer) -
setSoLingerOn
public void setSoLingerOn(boolean soLingerOn) -
setBufferPool
public void setBufferPool(int bufferPool) -
setBufferPoolSize
public void setBufferPoolSize(int bufferPoolSize) -
setEventCache
public void setEventCache(int eventCache) -
setAppReadBufSize
public void setAppReadBufSize(int appReadBufSize) -
setAppWriteBufSize
public void setAppWriteBufSize(int appWriteBufSize) -
setProcessorCache
public void setProcessorCache(int processorCache) -
setTimeoutInterval
public void setTimeoutInterval(long timeoutInterval) -
setDirectBufferPool
public void setDirectBufferPool(int directBufferPool) -
getUnlockTimeout
public int getUnlockTimeout() -
setUnlockTimeout
public void setUnlockTimeout(int unlockTimeout)
-