Improvements to the Jetty documentation.

Updated the bytebufferpool module documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2021-01-10 16:55:32 +01:00
parent f836f87754
commit 26d64bd9db
2 changed files with 23 additions and 11 deletions

View File

@ -15,8 +15,15 @@
==== Module `bytebufferpool` ==== Module `bytebufferpool`
The `bytebufferpool` module allows you to configure the server-wide `ByteBuffer` pool. The `bytebufferpool` module allows you to configure the server-wide `ByteBuffer` pool.
Pooling ``ByteBuffer``s results in less memory usage and less pressure on the Garbage Collector.
// TODO: expand ``ByteBuffer``s are pooled in _buckets_; each bucket as a capacity that is a multiple of a capacity factor that you can configure.
For example, if a request for a `ByteBuffer` of capacity 2000 is requested, and the capacity factor is 1024, then the pool will allocate a buffer from the second bucket, of capacity 2048 (1024 * 2).
Applications that need to sustain many concurrent requests -- or load spikes -- may require many buffers during peak load. These buffers will remain pooled once the system transitions to a lighter load (or becomes idle), and it may be undesirable to retain a lot of memory for an idle system.
It is possible to configure the max heap memory and the max direct memory that the pool retains.
Excess buffers will not be pooled and will be eventually garbage collected.
The module file is `$JETTY_HOME/modules/bytebufferpool.mod`: The module file is `$JETTY_HOME/modules/bytebufferpool.mod`:
@ -26,4 +33,8 @@ include::{JETTY_HOME}/modules/bytebufferpool.mod[]
Among the configurable properties, the most relevant are: Among the configurable properties, the most relevant are:
TODO `jetty.byteBufferPool.maxHeapMemory`::
This property allows you to cap the max heap memory retained by the pool.
`jetty.byteBufferPool.maxDirectMemory`::
This property allows you to cap the max direct memory retained by the pool.

View File

@ -1,5 +1,3 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description] [description]
Configures the ByteBufferPool used by ServerConnectors. Configures the ByteBufferPool used by ServerConnectors.
@ -10,21 +8,24 @@ logging
etc/jetty-bytebufferpool.xml etc/jetty-bytebufferpool.xml
[ini-template] [ini-template]
### Server ByteBufferPool Configuration ## Minimum capacity of a single ByteBuffer.
## Minimum capacity to pool ByteBuffers
#jetty.byteBufferPool.minCapacity=0 #jetty.byteBufferPool.minCapacity=0
## Maximum capacity to pool ByteBuffers ## Maximum capacity of a single ByteBuffer.
## Requests for ByteBuffers larger than this value results
## in the ByteBuffer being allocated but not pooled.
#jetty.byteBufferPool.maxCapacity=65536 #jetty.byteBufferPool.maxCapacity=65536
## Capacity factor ## Bucket capacity factor.
## ByteBuffers are allocated out of buckets that have
## a capacity that is multiple of this factor.
#jetty.byteBufferPool.factor=1024 #jetty.byteBufferPool.factor=1024
## Maximum queue length for each bucket (-1 for unbounded) ## Maximum queue length for each bucket (-1 for unbounded).
#jetty.byteBufferPool.maxQueueLength=-1 #jetty.byteBufferPool.maxQueueLength=-1
## Maximum heap memory retainable by the pool (-1 for unlimited) ## Maximum heap memory retainable by the pool (-1 for unlimited).
#jetty.byteBufferPool.maxHeapMemory=-1 #jetty.byteBufferPool.maxHeapMemory=-1
## Maximum direct memory retainable by the pool (-1 for unlimited) ## Maximum direct memory retainable by the pool (-1 for unlimited).
#jetty.byteBufferPool.maxDirectMemory=-1 #jetty.byteBufferPool.maxDirectMemory=-1