I have gotten an OutOfMemoryError in my Camel K route. I am using SEDA(one producer and multiple consumers) and feeding events with 10,000 events per second, even I use multiple consumers the error was thrown, does anyone know how to improve the performance?
I have tried to increase the consumers numbers but the issue hasn't been resolved and I tried increase the memory but the in-memory queue take too much memory.
Error Message:
2021-12-01 17:42:58,401 syslog-basic-68d776c9b4-js4cd io.quarkus.bootstrap.runner.QuarkusEntryPoint[1] WARN [io.net.cha.AbstractChannelHandlerContext] (Camel (camel-1) thread #1 - NettyConsumerExecutorGroup) An exception 'java.lang.OutOfMemoryError: Java heap space' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:: java.lang.OutOfMemoryError: Java heap space
Here's my source code for the SEDA routes:
from("netty:udp://" + HOST + ":" + PORT + "?sync=false&receiveBufferSize=16777216")
// .log("in: ${body}")
.to("seda:next?size=5000&timeout=0&blockWhenFull=true");
from("seda:next?concurrentConsumers=5")
.unmarshal(myDataFormat)
.routePolicy(myPolicy)
.process(myProcessor)
.choice()
.when(body().contains(MISSING_REQUIRED_FIELDS)).to("log:warning").otherwise()
.log("log:${body}");