configuration properties for frame size

This commit is contained in:
Patrik Nordwall 2016-09-26 11:57:37 +02:00
parent 0f376e751e
commit fb886f0df9
3 changed files with 36 additions and 6 deletions

View file

@ -190,6 +190,31 @@ akka {
log-sent-messages = off
advanced {
# Maximum serialized message size, including header data.
maximum-frame-size = 256 KiB
# Direct byte buffers are reused in a pool with this maximum size.
# Each buffer has the size of 'maximum-frame-size'.
# This is not a hard upper limit on number of created buffers. Additional
# buffers will be created if needed, e.g. when using many outbound
# associations at the same time. Such additional buffers will be garbage
# collected, which is not as efficient as reusing buffers in the pool.
buffer-pool-size = 128
# Maximum serialized message size for the large messages, including header data.
# See 'large-message-destinations'.
maximum-large-frame-size = 2 MiB
# Direct byte buffers for the large messages are reused in a pool with this maximum size.
# Each buffer has the size of 'maximum-large-frame-size'.
# See 'large-message-destinations'.
# This is not a hard upper limit on number of created buffers. Additional
# buffers will be created if needed, e.g. when using many outbound
# associations at the same time. Such additional buffers will be garbage
# collected, which is not as efficient as reusing buffers in the pool.
large-buffer-pool-size = 32
# For enabling testing features, such as blackhole in akka-remote-testkit.
test-mode = off

View file

@ -119,10 +119,15 @@ private[akka] final class ArterySettings private (config: Config) {
val FlightRecorderDestination: String = getString("flight-recorder.destination")
val Compression = new Compression(getConfig("compression"))
final val MaximumFrameSize = 1024 * 1024
final val MaximumPooledBuffers = 128
final val MaximumLargeFrameSize = MaximumFrameSize * 5
final val InboundBroadcastHubBufferSize = MaximumPooledBuffers / 2
final val MaximumFrameSize: Int = math.min(getBytes("maximum-frame-size"), Int.MaxValue).toInt
.requiring(_ >= 32 * 1024, "maximum-frame-size must be greater than or equal to 32 KiB")
final val BufferPoolSize: Int = getInt("buffer-pool-size")
.requiring(_ > 0, "buffer-pool-size must be greater than 0")
final val InboundBroadcastHubBufferSize = BufferPoolSize / 2
final val MaximumLargeFrameSize: Int = math.min(getBytes("maximum-large-frame-size"), Int.MaxValue).toInt
.requiring(_ >= 32 * 1024, "maximum-large-frame-size must be greater than or equal to 32 KiB")
final val LargeBufferPoolSize: Int = getInt("large-buffer-pool-size")
.requiring(_ > 0, "large-buffer-pool-size must be greater than 0")
}
}

View file

@ -353,8 +353,8 @@ private[remote] class ArteryTransport(_system: ExtendedActorSystem, _provider: R
private val restartCounter = new RestartCounter(settings.Advanced.InboundMaxRestarts, settings.Advanced.InboundRestartTimeout)
private val envelopeBufferPool = new EnvelopeBufferPool(settings.Advanced.MaximumFrameSize, settings.Advanced.MaximumPooledBuffers)
private val largeEnvelopeBufferPool = new EnvelopeBufferPool(settings.Advanced.MaximumLargeFrameSize, settings.Advanced.MaximumPooledBuffers)
private val envelopeBufferPool = new EnvelopeBufferPool(settings.Advanced.MaximumFrameSize, settings.Advanced.BufferPoolSize)
private val largeEnvelopeBufferPool = new EnvelopeBufferPool(settings.Advanced.MaximumLargeFrameSize, settings.Advanced.LargeBufferPoolSize)
private val inboundEnvelopePool = ReusableInboundEnvelope.createObjectPool(capacity = 16)
// The outboundEnvelopePool is shared among all outbound associations