title: Log4J2 AsyncLogger is filling up LMAX disruptor's ring buffer at high concurrency
body: <p>I am using Log4J2 AsyncLogger in my Java Play Framework based application. I see that at high concurrency (~3000 users per server) the ring buffer's remaining size reaches zero quickly and my requests start to fail. My ring buffer size is 1048576 (512*2048). The number of application threads are 8 (1 thread per core as stated in Play's official documentation.)
  My questions are:</p>
  
  <p>1> How can I increase the speed at which the consumer writes to the log file?
  2> Can I explicitly use multiple consumers to write to my log file? If so, where do I specify these consumers?</p>
  
  <p>I have included my log4j2.xml file. Any help will be highly appreciated :)</p>
  
  <p>Things I tried:</p>
  
  <p>1> Increased ring buffer size (always as a power of 2). But eventually the same problem arises, and using too much memory does not seem very elegant. This option will be shot down in production. Am I missing anything?</p>
  
  <p>2> Tried different waiting strategies. No luck.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;Configuration&gt;
  &lt;!--  status="trace" attribute for Configuration tag prints in logs [ Starting AsyncLoggerConfig disruptor for this configuration with ringbufferSize=262144] --&gt;
  &lt;!-- default log file names in case it fails to read it from property file --&gt;
  &lt;Properties&gt;
      &lt;Property name="FILE_NAME"&gt;/opt/lol/logs/meh.log&lt;/Property&gt;
      &lt;Property name="FILE_PATTERN"&gt;/opt/lol/logs/meh_%d{yyyy-MM-dd_HH}.log&lt;/Property&gt;
  &lt;/Properties&gt;
  
  &lt;Appenders&gt;
      &lt;RollingRandomAccessFile name="ASYNCFILE" fileName="${sys:FILE_NAME}" filePattern="${sys:FILE_PATTERN}"&gt;
          &lt;PatternLayout pattern="[meh:%d{yyyy-MM-dd HH:mm:ss},%d{SSS}] %-5level[%thread][%C{1}:%L] %msg%n"/&gt;
          &lt;Policies&gt;
              &lt;TimeBasedTriggeringPolicy /&gt;
          &lt;/Policies&gt;
      &lt;/RollingRandomAccessFile&gt;
  
      &lt;Console name="CONSOLE" target="SYSTEM_OUT"&gt;
          &lt;PatternLayout pattern="[meh:%d{yyyy-MM-dd HH:mm:ss},%d{SSS}] %-5level[%thread][%C{1}:%L] %msg%n"/&gt;
      &lt;/Console&gt;
  &lt;/Appenders&gt;
  
  &lt;Loggers&gt;
      &lt;logger name="akka" level="INFO" /&gt;
      &lt;AsyncRoot level="INFO" includeLocation="true"&gt;
         &lt;!-- &lt;AppenderRef ref="CONSOLE"/&gt;--&gt;
          &lt;AppenderRef ref="ASYNCFILE"/&gt;
      &lt;/AsyncRoot&gt;
  &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>I expect the concurrency to hit at least 4000 per box (the same as without loggers). But I am stuck at around 2500.</p>