[logback-user] log4j performance comparison

Ralph Goers rgoers at apache.org
Mon Mar 21 02:32:08 CET 2011


The main takeaway for me is that the default should be to do buffered I/O. Unfortunately, I didn't see an option in Logback to enable buffering at all, much less make it the default. I'm doing that in Log4j2.  Doing that cut my overall elapsed time in half.

Ralph

On Mar 20, 2011, at 9:31 AM, hostalp at post.cz wrote:

> Yeah, also interesting stuff.
> And more just for the curiosity - I tried to wrap the FileWriter by BufferedWriter ( http://download.oracle.com/javase/6/docs/api/java/io/BufferedWriter.html ) in your test and to no surprise the result also became very close to BufferedOutputStream.
> 
> Following results are from 2nd runs within the JVM instance as first runs are (as usually) a little more "biased":
> 
> Java 6:
> FileOutputStream: 7186
> BufferedOutputStream: 613
> FileWriter: 713
> BufferedWriter/FileWriter: 625
> 
> Java 1.5:
> FileOutputStream: 7765
> BufferedOutputStream: 955
> FileWriter: 1131
> BufferedWriter/FileWriter: 918
> 
> Looks like the use of FileWriter itself is a decent option while adding buffering always helps at least a little.
> Also funny that BufferedWriter around FileWriter performs consistently better than BufferedOutputStream at Java 1.5 while at Java 6 it's exactly the opposite (but here the difference is minor).
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list