[logback-user] log4j performance comparison

David Roussel nabble at diroussel.xsmail.com
Mon Apr 11 11:21:46 CEST 2011


Hi,

I guess all the results here are for local files.  We log to network file
shares over SMB.  So I decided to run the PerformanceComparison test from
this thread on Windows XP and Java 1.6.0_07 for local and remote files. 
Here are the results...

###############################################
local, FileOutputStream:     7031
local, BufferedOutputStream: 3008
local, FileWriter:           2653
local, FileChannel:          8259
###############################################

###############################################
remote, FileOutputStream:     1618729
remote, BufferedOutputStream: 8743
remote, FileWriter:           8191
remote, FileChannel:          1623684
###############################################

So can we make logback use FileWriter?  It seems to be the best for both
local and remote files.

Also, bizarely, after the test had ran, when I look in the local and remote
folders that I was writting to, there were the testbuffer.log and testos.log
files, but there was no testchannel.log file?  I'm not NIO expert, and the
FileOutputStream is being closed, so what's going wrong?

David



Peter-262 wrote:
> 
> Yeah, with few more (and hopefuly last) things to add:
> 
> Not flushing after every line doesn't seem to make a difference for
> FileOutputStream in isolated tests (I was getting identical times as with
> flushing) - unless buffering of course - but it does make difference with
> logback which uses this FileOutputStream.
> However logback wraps OutputStreamWriter around it and then it really
> makes that difference - and also results become very close (almost
> identical) to FileWriter then.
> 
> 
> Java 1.5 only:
> OutputStreamWriter/FileOutputStream immediateFlush: 8435
> OutputStreamWriter/FileOutputStream no-flush: 1160
> BufferedWriter/OutputStreamWriter/FileOutputStream no-flush: 922
> 
> FileWriter immediateFlush: 8271
> FileWriter no-flush: 1150
> BufferedWriter/FileWriter no-flush: 918
> 
> 
> In real logging scenarios it looks to me that immediateFlush=false
> decreases times to 1/2-1/3 and buffering can give further 10-15%
> improvement with properly sized buffer.
> 
> So I definitely vote for bringing at least the immediateFlush=false option
> back.
> Bringing back buffering would also be great as one can get a bit more
> performance out of it - and every little bit does matter for us here. :)
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://old.nabble.com/log4j-performance-comparison-tp31183677p31368496.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list