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.
|
* This allows the user to setup the error filter for Aeron *SPECIFIC* error messages.
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,7 @@ class AeronContext(
|
|||||||
|
|
||||||
): MediaDriver.Context {
|
): MediaDriver.Context {
|
||||||
// LOW-LATENCY SETTINGS
|
// LOW-LATENCY SETTINGS
|
||||||
|
// MediaDriver.Context()
|
||||||
// .termBufferSparseFile(false)
|
// .termBufferSparseFile(false)
|
||||||
// .useWindowsHighResTimer(true)
|
// .useWindowsHighResTimer(true)
|
||||||
// .threadingMode(ThreadingMode.DEDICATED)
|
// .threadingMode(ThreadingMode.DEDICATED)
|
||||||
@ -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)
|
// driver context must happen in the initializer, because we have a Server.isRunning() method that uses the mediaDriverContext (without bind)
|
||||||
val mediaDriverContext = MediaDriver.Context()
|
val mediaDriverContext = MediaDriver.Context()
|
||||||
|
.termBufferSparseFile(false) // files occupy the same space virtually AND physically!
|
||||||
.publicationReservedSessionIdLow(AeronDriver.RESERVED_SESSION_ID_LOW)
|
.publicationReservedSessionIdLow(AeronDriver.RESERVED_SESSION_ID_LOW)
|
||||||
.publicationReservedSessionIdHigh(AeronDriver.RESERVED_SESSION_ID_HIGH)
|
.publicationReservedSessionIdHigh(AeronDriver.RESERVED_SESSION_ID_HIGH)
|
||||||
|
|
||||||
.threadingMode(config.threadingMode)
|
.threadingMode(config.threadingMode)
|
||||||
.mtuLength(config.networkMtuSize)
|
.mtuLength(config.networkMtuSize)
|
||||||
|
|
||||||
@ -53,7 +56,6 @@ class AeronContext(
|
|||||||
.socketSndbufLength(config.sendBufferSize)
|
.socketSndbufLength(config.sendBufferSize)
|
||||||
.socketRcvbufLength(config.receiveBufferSize)
|
.socketRcvbufLength(config.receiveBufferSize)
|
||||||
|
|
||||||
mediaDriverContext
|
|
||||||
.conductorThreadFactory(threadFactory)
|
.conductorThreadFactory(threadFactory)
|
||||||
.receiverThreadFactory(threadFactory)
|
.receiverThreadFactory(threadFactory)
|
||||||
.senderThreadFactory(threadFactory)
|
.senderThreadFactory(threadFactory)
|
||||||
@ -62,14 +64,12 @@ class AeronContext(
|
|||||||
|
|
||||||
mediaDriverContext.aeronDirectoryName(config.aeronDirectory!!.absolutePath)
|
mediaDriverContext.aeronDirectoryName(config.aeronDirectory!!.absolutePath)
|
||||||
|
|
||||||
if (mediaDriverContext.ipcTermBufferLength() != io.aeron.driver.Configuration.ipcTermBufferLength()) {
|
if (config.ipcTermBufferLength > 0) {
|
||||||
// default 64 megs each is HUGE
|
mediaDriverContext.ipcTermBufferLength(config.ipcTermBufferLength)
|
||||||
mediaDriverContext.ipcTermBufferLength(8 * 1024 * 1024)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaDriverContext.publicationTermBufferLength() != io.aeron.driver.Configuration.termBufferLength()) {
|
if (config.publicationTermBufferLength > 0) {
|
||||||
// default 16 megs each is HUGE (we run out of space in production w/ lots of clients)
|
mediaDriverContext.publicationTermBufferLength(config.publicationTermBufferLength)
|
||||||
mediaDriverContext.publicationTermBufferLength(2 * 1024 * 1024)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we DO NOT want to abort the JVM if there are errors.
|
// we DO NOT want to abort the JVM if there are errors.
|
||||||
|
Loading…
Reference in New Issue
Block a user