Added support for IPC/UDP term buffer length (with the default the same as it was previously)
This commit is contained in:
parent
951dba3af6
commit
8ae3f15f8e
@ -465,6 +465,46 @@ abstract class Configuration {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "term" buffer is the size of EACH of the 3 (Active, Dirty, Clean) log files that are used to send/receive messages.
|
||||
* - the smallest term buffer length is 65536 bytes;
|
||||
* - the largest term buffer length is 1,073,741,824 bytes;
|
||||
* - the size must be a power of 2;
|
||||
* - maximum message length is the smallest value of 16 megabytes or (term buffer length) / 8;
|
||||
*
|
||||
* A value of 0 will 'auto-configure' this setting to use the default of 64 megs. Be wary, it is easy to run out of space w/ lots of clients
|
||||
*
|
||||
* @see [io.aeron.driver.Configuration.TERM_BUFFER_IPC_LENGTH_DEFAULT]
|
||||
* @see [io.aeron.logbuffer.LogBufferDescriptor.TERM_MIN_LENGTH]
|
||||
* @see [io.aeron.logbuffer.LogBufferDescriptor.TERM_MAX_LENGTH]
|
||||
*/
|
||||
var ipcTermBufferLength = 8 * 1024 * 1024
|
||||
set(value) {
|
||||
require(!contextDefined) { errorMessage }
|
||||
field = value
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "term" buffer is the size of EACH of the 3 (Active, Dirty, Clean) log files that are used to send/receive messages.
|
||||
* - the smallest term buffer length is 65536 bytes;
|
||||
* - the largest term buffer length is 1,073,741,824 bytes;
|
||||
* - the size must be a power of 2;
|
||||
* - maximum message length is the smallest value of 16 megabytes or (term buffer length) / 8;
|
||||
*
|
||||
* A value of 0 will 'auto-configure' this setting to use the default of 16 megs. Be wary, it is easy to run out of space w/ lots of clients
|
||||
*
|
||||
* @see [io.aeron.driver.Configuration.TERM_BUFFER_LENGTH_DEFAULT]
|
||||
* @see [io.aeron.logbuffer.LogBufferDescriptor.TERM_MIN_LENGTH]
|
||||
* @see [io.aeron.logbuffer.LogBufferDescriptor.TERM_MAX_LENGTH]
|
||||
*/
|
||||
var publicationTermBufferLength = 2 * 1024 * 1024
|
||||
set(value) {
|
||||
require(!contextDefined) { errorMessage }
|
||||
field = value
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This allows the user to setup the error filter for Aeron *SPECIFIC* error messages.
|
||||
*
|
||||
|
@ -30,7 +30,8 @@ class AeronContext(
|
||||
|
||||
): MediaDriver.Context {
|
||||
// LOW-LATENCY SETTINGS
|
||||
// .termBufferSparseFile(false)
|
||||
// MediaDriver.Context()
|
||||
// .termBufferSparseFile(false)
|
||||
// .useWindowsHighResTimer(true)
|
||||
// .threadingMode(ThreadingMode.DEDICATED)
|
||||
// .conductorIdleStrategy(BusySpinIdleStrategy.INSTANCE)
|
||||
@ -44,8 +45,10 @@ class AeronContext(
|
||||
|
||||
// driver context must happen in the initializer, because we have a Server.isRunning() method that uses the mediaDriverContext (without bind)
|
||||
val mediaDriverContext = MediaDriver.Context()
|
||||
.termBufferSparseFile(false) // files occupy the same space virtually AND physically!
|
||||
.publicationReservedSessionIdLow(AeronDriver.RESERVED_SESSION_ID_LOW)
|
||||
.publicationReservedSessionIdHigh(AeronDriver.RESERVED_SESSION_ID_HIGH)
|
||||
|
||||
.threadingMode(config.threadingMode)
|
||||
.mtuLength(config.networkMtuSize)
|
||||
|
||||
@ -53,7 +56,6 @@ class AeronContext(
|
||||
.socketSndbufLength(config.sendBufferSize)
|
||||
.socketRcvbufLength(config.receiveBufferSize)
|
||||
|
||||
mediaDriverContext
|
||||
.conductorThreadFactory(threadFactory)
|
||||
.receiverThreadFactory(threadFactory)
|
||||
.senderThreadFactory(threadFactory)
|
||||
@ -62,14 +64,12 @@ class AeronContext(
|
||||
|
||||
mediaDriverContext.aeronDirectoryName(config.aeronDirectory!!.absolutePath)
|
||||
|
||||
if (mediaDriverContext.ipcTermBufferLength() != io.aeron.driver.Configuration.ipcTermBufferLength()) {
|
||||
// default 64 megs each is HUGE
|
||||
mediaDriverContext.ipcTermBufferLength(8 * 1024 * 1024)
|
||||
if (config.ipcTermBufferLength > 0) {
|
||||
mediaDriverContext.ipcTermBufferLength(config.ipcTermBufferLength)
|
||||
}
|
||||
|
||||
if (mediaDriverContext.publicationTermBufferLength() != io.aeron.driver.Configuration.termBufferLength()) {
|
||||
// default 16 megs each is HUGE (we run out of space in production w/ lots of clients)
|
||||
mediaDriverContext.publicationTermBufferLength(2 * 1024 * 1024)
|
||||
if (config.publicationTermBufferLength > 0) {
|
||||
mediaDriverContext.publicationTermBufferLength(config.publicationTermBufferLength)
|
||||
}
|
||||
|
||||
// we DO NOT want to abort the JVM if there are errors.
|
||||
|
Loading…
Reference in New Issue
Block a user