I use log4j2 2.10.0 and have the following code:
SingleChronicleQueue q = SingleChronicleQueueBuilder.binary(args[0]).blockSize(536870912).build();
ExcerptAppender a = q.acquireAppender();
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 1000; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
String t = sb.toString();
for (int i = 0; i < 1000000; i ++ ) {
m_logger.info(i + " " + t);
a.writeText(t);
}
Both the cq4 and the log is writing to the same dir.
And in the log, it was blasting out fine until I can see
12:40:00.853 - [main] INFO c.c.c.a.r.SandboxApp 601049
12:40:00.853 - [main] INFO c.c.c.a.r.SandboxApp 601050
12:40:00.853 - [main] INFO c.c.c.a.r.SandboxApp 601051
12:40:06.156 - [main] INFO c.c.c.a.r.SandboxApp 601052
There's some sort of IO operation that made it delayed 6 seconds.
I don't know enough about disk, mount, etc. This would disappear if I comment out the writeText but I don't know if it's a chronicle problem or log4j2.
My log4j2 parameter is
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -DAsyncLogger.RingBufferSize=65536*65536 -DAsyncLogger.WaitStrategy=Sleep -Dlog4j2.AsyncQueueFullPolicy=Discard -Dlog4j2.DiscardThreshold=INFO
Here's what the profiler is showing
Thanks!!