Align XNF simulator batch with Netty's queue size 66/75366/2
authorJakub Dudycz <jakub.dudycz@nokia.com>
Mon, 7 Jan 2019 14:30:34 +0000 (15:30 +0100)
committerJakub Dudycz <jakub.dudycz@nokia.com>
Tue, 8 Jan 2019 12:00:49 +0000 (13:00 +0100)
This change will lessen the probability of out of memory errors

Change-Id: I96c735f4d7f5cedf3fddd66830e6557ea35ad1ea
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Issue-ID: DCAEGEN2-1062

sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt

index ca6d169..d32ca80 100644 (file)
@@ -35,6 +35,7 @@ import reactor.core.publisher.Mono
 import reactor.core.publisher.ReplayProcessor
 import reactor.netty.NettyOutbound
 import reactor.netty.tcp.TcpClient
+import reactor.util.concurrent.Queues.XS_BUFFER_SIZE
 
 /**
  * @author Jakub Dudycz <jakub.dudycz@nokia.com>
@@ -81,7 +82,7 @@ class VesHvClient(private val configuration: SimulatorConfiguration) {
         val encoder = WireFrameEncoder(allocator)
         val frames = messages
                 .map(encoder::encode)
-                .window(MAX_BATCH_SIZE)
+                .window(XS_BUFFER_SIZE)
 
         return nettyOutbound
                 .logConnectionClosed()
@@ -106,6 +107,5 @@ class VesHvClient(private val configuration: SimulatorConfiguration) {
 
     companion object {
         private val logger = Logger(VesHvClient::class)
-        private const val MAX_BATCH_SIZE = 128
     }
 }