Here are my results (Athlon 900, 512MBRAM, development machine, windows, jdk 1.3, running in IDEA):
buffered: false, immediateFlush: true, avg log time: 141.8 in microseconds. buffered: false, immediateFlush: true, avg log time: 145.01 in microseconds. buffered: false, immediateFlush: true, avg log time: 150.41 in microseconds. buffered: false, immediateFlush: true, avg log time: 152.01 in microseconds. buffered: false, immediateFlush: true, avg log time: 153.82 in microseconds. buffered: false, immediateFlush: false, avg log time: 128.98 in microseconds. buffered: false, immediateFlush: false, avg log time: 133.09 in microseconds. buffered: false, immediateFlush: false, avg log time: 139.6 in microseconds. buffered: false, immediateFlush: false, avg log time: 141.0 in microseconds. buffered: false, immediateFlush: false, avg log time: 142.7 in microseconds. buffered: true, immediateFlush: false, avg log time: 125.28 in microseconds. buffered: true, immediateFlush: false, avg log time: 129.28 in microseconds. buffered: true, immediateFlush: false, avg log time: 130.49 in microseconds. buffered: true, immediateFlush: false, avg log time: 133.19 in microseconds. buffered: true, immediateFlush: false, avg log time: 135.89 in microseconds. Regards, Mathias ------------------------ "Log4J Developers List" <[EMAIL PROTECTED]> wrote: ------------------------ Hello all, > > >As you probably know, performance of buffered IO is supposed to be >much much better then non-buffered IO. In around mid 2001, we had a >discussion about buffered IO and although buffered IO is supposedly >faster my own tests showed that when outputting logs (write only >operation) this was not the case. There were no performance gains that >could be observed. Note that all the articles and books discussing >buffered IO carry out read-only tests without any writing. So since >performance gains could not be verified independently, we did not add >buffered IO functionality to log4j. > >In early 2002, a user (I can't find the name since Bugzilla is down) >filed a bug report claiming that on a heavily used server machine >adding buffered IO to FileAppender gave a perceptible boost to logging >performance. As a response we added buffered IO to FileAppender. > >The problem is that I sill can't see any 10 fold improvements that >some tuning experts assign to buffered IO. > >Here is a short test file that tests the performance of >FileAppender. It uses multiple threads to imitate a >"heavily" loaded server. > >import org.apache.log4j.*; > >public class IO extends Thread { > > static String msg = >"ABCDEGHIJKLMNOPQRSTUVWXYZabcdeghijklmnopqrstuvwxyz1234567890"; > static int BUF_SIZE = 1024*4; > > public static void main(String argv[]) throws Exception { > > // What is the length of the runs? > long len = Integer.parseInt(argv[0]); > > boolean buffered; > boolean immediateFlush; > IO io = null; > > > // first test with unbuffered IO and immediate flushing > buffered = false; > immediateFlush = true; > for(int i = 0; i javac IO.java > ~/ > java IO 100000 >buffered: false, immediateFlush: true, avg log time: 91.94 in microseconds. >buffered: false, immediateFlush: true, avg log time: 94.94 in microseconds. >buffered: false, immediateFlush: true, avg log time: 97.04 in microseconds. >buffered: false, immediateFlush: true, avg log time: 96.44 in microseconds. >buffered: false, immediateFlush: true, avg log time: 99.74 in microseconds. >buffered: false, immediateFlush: false, avg log time: 67.1 in microseconds. >buffered: false, immediateFlush: false, avg log time: 73.21 in microseconds. >buffered: false, immediateFlush: false, avg log time: 72.61 in microseconds. >buffered: false, immediateFlush: false, avg log time: 74.21 in microseconds. >buffered: false, immediateFlush: false, avg log time: 76.11 in microseconds. >buffered: true, immediateFlush: false, avg log time: 61.79 in microseconds. >buffered: true, immediateFlush: false, avg log time: 63.99 in microseconds. >buffered: true, immediateFlush: false, avg log time: 68.1 in microseconds. >buffered: true, immediateFlush: false, avg log time: 70.1 in microseconds. >buffered: true, immediateFlush: false, avg log time: 71.0 in microseconds. > > >As you can see, immediate flushing has an impact on performance whereas >buffering does not. The test was run on Windows (JDK 1.2.2, 1.3.1) and >Linux (JDK 1.4.0) with very similar outcomes. > >Is it possible that the experts are wrong? Could you run the test on >other platforms and post the results here? (The whole shebang takes >about 5 minutes.) Many thanks in advance, > > >-- >Ceki > >SUICIDE BOMBING - A CRIME AGAINST HUMANITY >Sign the petition: http://www.petitiononline.com/1234567b >I am signatory number 22106. What is your number? > > >-- >To unsubscribe, e-mail: >For additional commands, e-mail: -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>