You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Michiel Meeuwissen <Mi...@omroep.nl> on 2001/02/12 10:59:56 UTC

AsyncAppender in linux

I did a little research if using the AsyncAppender would make
sense. So, I made a little program with delays in it etc, as is
suggested in the Logging javadoc of log4j. I do find no improvements
tough in the performance, when using AsyncAppender. The thing is,
that even without AsyncAppender logging gets faster. 

So, before that I'm going to do everything all over again, to check
the results, I have a question.

I'm using linux. Could that have anything to do with it? I think I've
heard that linux buffers in- and output by itself? If that it true,
the whole AsyncAppender in linux (and other Unixes?) would be rather
senseless, isn't it?

greetings,

 Michiel

-- 
Michiel Meeuwissen - NOS internet 
Mediacentrum kamer 203 - tel. +31 (0)35 6773065
http://www.mmbase.org  
http://www.purl.org/NET/mihxil/


Re: AsyncAppender in linux

Posted by Ceki Gülcü <cg...@qos.ch>.
Michiel,

The usefulness or lack thereof of AsyncAppender is not dependent on the OS. The new JVMs do file buffering on all platforms. Don't confuse buffering of the file write operation with what AsyncAppender does.

File buffering let you write large chunks to disk instead of writing small chunks. The AsyncAppender allows you to do logging while some other work thread is blocked, typically while doing I/O.

Here is a test that should be more convincing:

for(int n = 0; n < N; n++) {

  for(int i = 0; i < 10; i++)
    log(msg);
 
  sleep(20); // 20 millisecs
}

Set N to some large value like 1000 or higher.

    Cost of logging = total run time - N*20

The cost of logging can be negative, because the actual time slept can be shorter than 20 msecs.

Measure the difference between logging AsyncAppender+FileAppender versus FileAppender only. See what you get. Ceki

At 09:54 13.02.2001 +0100, you wrote:
>Ceki Gülcü <cg...@qos.ch> wrote:
>
>> Michiel,
>> 
>
>> What kind of testing are you doing? What do you mean by logging gets
>> faster? With respect to what? Cheers, Ceki
>
>A loop with in it one logging statement, and sometimes a delay. It get
>faster per logging then without a delay. That's the idea of
>AsyncAppender, isn't it? But the thing is, it also gets faster per
>logging if I don't use AsyncAppender. With about the same rate. At
>least, that's my provisional result. 
>
>My explanation would be linux file buffering, which makes writing to
>files faster in these case anyway.
>
>My question was if that would be a sensible explanation, and my
>remark, that if I'm right (I'm not sure), that then it does not make
>sense using AsyncAppender, because the OS is doing the same job.
>
> Michiel.
>
>-- 
>Michiel Meeuwissen - NOS internet 
>Mediacentrum kamer 203 - tel. +31 (0)35 6773065
>http://www.mmbase.org  
>http://www.purl.org/NET/mihxil/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

----
Ceki Gülcü           e-mail: cgu@qos.ch (preferred)
av. de Rumine 5              ceki_gulcu@yahoo.com
CH-1005 Lausanne          
Switzerland            Tel: ++41 21 351 23 15


Re: AsyncAppender in linux

Posted by Michiel Meeuwissen <Mi...@omroep.nl>.
Ceki Gülcü <cg...@qos.ch> wrote:

> Michiel,
> 

> What kind of testing are you doing? What do you mean by logging gets
> faster? With respect to what? Cheers, Ceki

A loop with in it one logging statement, and sometimes a delay. It get
faster per logging then without a delay. That's the idea of
AsyncAppender, isn't it? But the thing is, it also gets faster per
logging if I don't use AsyncAppender. With about the same rate. At
least, that's my provisional result. 

My explanation would be linux file buffering, which makes writing to
files faster in these case anyway.

My question was if that would be a sensible explanation, and my
remark, that if I'm right (I'm not sure), that then it does not make
sense using AsyncAppender, because the OS is doing the same job.

 Michiel.

-- 
Michiel Meeuwissen - NOS internet 
Mediacentrum kamer 203 - tel. +31 (0)35 6773065
http://www.mmbase.org  
http://www.purl.org/NET/mihxil/


Re: AsyncAppender in linux

Posted by Ceki Gülcü <cg...@qos.ch>.

Michiel,

What kind of testing are you doing? What do you mean by logging gets faster? With respect to what? Cheers, Ceki

At 10:59 12.02.2001 +0100, you wrote:

>I did a little research if using the AsyncAppender would make
>sense. So, I made a little program with delays in it etc, as is
>suggested in the Logging javadoc of log4j. I do find no improvements
>tough in the performance, when using AsyncAppender. The thing is,
>that even without AsyncAppender logging gets faster. 
>
>So, before that I'm going to do everything all over again, to check
>the results, I have a question.
>
>I'm using linux. Could that have anything to do with it? I think I've
>heard that linux buffers in- and output by itself? If that it true,
>the whole AsyncAppender in linux (and other Unixes?) would be rather
>senseless, isn't it?
>
>greetings,
>
> Michiel
>
>-- 
>Michiel Meeuwissen - NOS internet 
>Mediacentrum kamer 203 - tel. +31 (0)35 6773065
>http://www.mmbase.org  
>http://www.purl.org/NET/mihxil/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

----
Ceki Gülcü           e-mail: cgu@qos.ch (preferred)
av. de Rumine 5              ceki_gulcu@yahoo.com
CH-1005 Lausanne          
Switzerland            Tel: ++41 21 351 23 15