[ 
https://issues.apache.org/jira/browse/LOG4J2-437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13806032#comment-13806032
 ] 

Remko Popma commented on LOG4J2-437:
------------------------------------

Giri, in addition to Ralph's questions, can I exclude some possibilities first:
* Were there any other changes to the system other than the migration to 
log4j2? (Unrelated code changes, different memory or GC settings, other system 
property changes?)
* You mentioned you are running on a virtual machine (I assume VMWare or KVM or 
something like that). Are you sharing the box with other applications? Can you 
exclude the possibility that the poor performance you are seeing is caused by 
other applications using more CPU/memory on the shared box because they changed 
recently?

About the config:
* Are you using async loggers (for example by setting {{-DLog4jContextSelector 
=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector}}) ? 
* Assuming the answer to the previous question was no, the configuration is to 
have the root logger sending to an AsyncAppender. The AsyncAppender does not 
perform as well as Async Loggers, especially in multi-threaded scenarios. Can 
you give Async Loggers a try?
* Also in the current config, three named loggers are logging synchronously to 
the RandomAccessFile Appender. This may cause lock contention if many threads 
try to add to the same buffer at the same time. They also seem to log to the 
same file used by the root logger, so you will get the same result as simply 
logging everything through the root logger. Can we try removing the named 
loggers? (We can add them back later after the performance issue is resolved.)
* The current config logs the same information twice: the AsyncAppender logs to 
both the "APP_1066_LOG" RandomAccessFile Appender and the "hibernateAppender" 
RandomAccessFile Appender. I could not see any difference in the configuration 
for these two. Could one of them be removed? That should cut the I/O in half.

Taking all of the above into account, can you try again with async loggers (set 
system property {{-DLog4jContextSelector 
=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector}}) and the 
simplified config below:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="trace" >
  <appenders>
    <RollingRandomAccessFile name="fileAppender" 
fileName=“/path/to/log/anotherfile-1066.log" 
filePattern=“/path/to/log/anotherfile-1066.log.%i" append="true" 
immediateFlush="false">
      <PatternLayout>
        <pattern>%d{ISO8601} %-5p [%t]: [%c{1}] %m%n - 
%X{ElapsedTime}-%X{ByteSize}- 
%X{uniqueID}-%X{HttpMethod}-%X{Host}-%X{URL}-%X{ClientIP}-%X{NodeID}-%X{NodeUserID}-%X{HttpCode}-%X{ApplicationCode}</pattern>
      </PatternLayout>
      <Policies>
        <SizeBasedTriggeringPolicy size="250 MB"/>
      </Policies>
      <DefaultRolloverStrategy max="10"/>
    </RollingRandomAccessFile>
  </appenders>
  <loggers>
    <root level="INFO">
      <appender-ref ref="fileAppender"/>
    </root>
  </loggers>
</configuration>
{code}



> Log4J2 Performs poorly with 500 concurrent users with Jboss 5.1.GA and JDK 6
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-437
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-437
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta9
>         Environment: JDK                : 1.6.0_18
> APP Server    :  Jboss 5.1.0_GA
> Task               : Migrate from Log4J_1.2 to Log4J2
> OS                 : Linux 5 (Virtual Machine)
>            Reporter: Giri Kosuru
>            Priority: Critical
>              Labels: Performance
>
> Environment Details
> ================
> JDK                : 1.6.0_18
> APP Server    :  Jboss 5.1.0_GA
> Task               : Migrate from Log4J_1.2 to Log4J2
> OS                 : Linux 5 (Virtual Machine)
> We are trying to upgrade from Log4J 1.2 to Log4J2 due to performance reasons. 
> In log4j1.2, we saw thread BLOCKING and decided to go to LOG4J2. Before 
> migration, we tested to evaluate and we found performance improvement with 
> LOG4J2. 
> After full migration, when application moved to performance testing 
> environment, we started seeing trouble with Log4j2. We saw at least 40 TPS 
> down, with increased response times; in performance. When diagnosed, found 
> that there is increased SWAPPING  on linux and with increased IO waits (Some 
> times 15 %). 
> For the same given environment and load test; application with LOG4J_1.2 code 
> , does not have  any SWAPPING and IO waits. In addition we have BAD 
> performance with LOG4J2.
> Can anyone give us pointers on what we are doing wrong ? Or there are some 
> performance issues with LOG4J2 ?? We are stuck in between releases and if 
> there is no help coming, we may just abandon LOG4J2. So Please I request you 
> to look seriously and give us some pointers.
> Following is the configuration for log4j2.
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="trace" verbose="true">
>         <appenders>
>                 <RollingRandomAccessFile name=“APP_1066_LOG" 
> fileName=“/path/to/log/file-1066.log" 
> filePattern=“/path/to/log/file-1066.log.%i" append="true" 
> immediateFlush="false">
>                         <PatternLayout>
>                                 <pattern>%d{ISO8601} %-5p [%t]: [%c{1}] %m%n 
> - %X{ElapsedTime}-%X{ByteSize}- 
> %X{uniqueID}-%X{HttpMethod}-%X{Host}-%X{URL}-%X{ClientIP}-%X{NodeID}-%X{NodeUserID}-%X{HttpCode}-%X{ApplicationCode}</pattern>
>                         </PatternLayout>
>                         <Policies>
>                                 <SizeBasedTriggeringPolicy size="250 MB"/>
>                         </Policies>
>                         <DefaultRolloverStrategy max="10"/>
>                 </RollingRandomAccessFile>
>                 <RollingRandomAccessFile name="hibernateAppender" 
> fileName=“/path/to/log/anotherfile-1066.log" 
> filePattern=“/path/to/log/anotherfile-1066.log.%i" append="true" 
> immediateFlush="false">
>                         <PatternLayout>
>                                 <pattern>%d{ISO8601} %-5p [%t]: [%c{1}] %m%n 
> - %X{ElapsedTime}-%X{ByteSize}- 
> %X{uniqueID}-%X{HttpMethod}-%X{Host}-%X{URL}-%X{ClientIP}-%X{NodeID}-%X{NodeUserID}-%X{HttpCode}-%X{ApplicationCode}</pattern>
>                         </PatternLayout>
>                         <Policies>
>                                 <SizeBasedTriggeringPolicy size="250 MB"/>
>                         </Policies>
>                         <DefaultRolloverStrategy max="10"/>
>                 </RollingRandomAccessFile>
>                 <Async name="ASYNC">
>                         <appender-ref ref="hibernateAppender"/>
>                         <appender-ref ref=“APP_1066_LOG"/>
>                 </Async>
>         </appenders>
>         <loggers>
>                 <root level="INFO">
>                         <appender-ref ref="ASYNC"/>
>                 </root>
>         <!-- ============================== -->
>         <!-- Various loggers -->
>         <!-- ============================== -->
>         <logger name="org.hibernate" additivity="false" level="INFO">
>                 <appender-ref ref="hibernateAppender" />
>         </logger>
>         <logger name="org.springframework.orm.hibernate3" additivity="false" 
> level="INFO">
>                 <appender-ref ref="hibernateAppender" />
>         </logger>
>         <logger name="org.hibernate.SQL" level="INFO">
>                 <appender-ref ref="hibernateAppender" />
>         </logger>
>         </loggers>
> </configuration>
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to