[logback-user] logback console appender slow on windows xp
Peter Kullmann
p.kullmann at arenae.ch
Wed Dec 21 10:55:34 CET 2011
Hi Ceki,
The problem manifests itself under windows xp. Windows 7 is much better.
Peter
Am 21.12.2011 um 09:47 schrieb ceki:
> Hi Peter,
>
> FYI, running the little application you provided under JDK 1.6.0_23-b05 and Windows 7, I get 4.8 seconds with java and 1.1 seconds under javaw.
>
> I am unable to reproduce the performance problem.
>
> --
> Ceki
> http://twitter.com/#!/ceki
>
> On 21.12.2011 09:19, Peter Kullmann wrote:
>> Hi Ceki
>>
>> I have tried using System.out.println() instead of logger.debug(). It is fast (less than a second).
>>
>> Best regards,
>> Peter
>>
>> Am 20.12.2011 um 18:50 schrieb ceki:
>>
>>> Hi Peter,
>>>
>>> If I understand correctly, you have shown that invoking System.out.println is slow with javaw. Do you know why?
>>> If the reason was known, for example it was due to exceptions being thrown, ConsoleAppender could address that problem.
>>>
>>> Is it possible to check whether an app is running under javaw and not java? ConsoleAppender could disable itself under javaw.
>>>
>>> --
>>> Ceki
>>> http://twitter.com/#!/ceki
>>>
>>> On 20.12.2011 18:34, Peter Kullmann wrote:
>>>> Hi,
>>>>
>>>> we had a problem with the performance of our application and it boiled down to very bad performance of the console appender when there is no console (in particular on windows xp).
>>>>
>>>> You can see the whole context of the issue here: http://www.eclipse.org/forums/index.php/m/768740/#msg_768740
>>>>
>>>> Here's the conclusion and the code for my experiments:
>>>>
>>>>
>>>> package testlogback;
>>>>
>>>> import java.io.FileWriter;
>>>> import java.io.IOException;
>>>>
>>>> import org.slf4j.Logger;
>>>> import org.slf4j.LoggerFactory;
>>>>
>>>> public class Main {
>>>> public static void main(String[] args) throws IOException {
>>>> Logger logger = LoggerFactory
>>>> .getLogger("chapters.introduction.HelloWorld1");
>>>> long start = System.currentTimeMillis();
>>>> for (int i = 0; i< 10000; i++) {
>>>> logger.debug("Hello world.");
>>>> }
>>>> long end = System.currentTimeMillis();
>>>>
>>>> FileWriter fileWriter = new FileWriter("logbacktest.out");
>>>> fileWriter.write("Time: " + (end - start) + "\n");
>>>> fileWriter.close();
>>>> System.out.println("Time: " + (end - start));
>>>> }
>>>> }
>>>>
>>>>
>>>> On my windows box it prints out "Time: 140" when started as "java -jar testlogback.jar". If I start "javaw -jar testlogback.jar" it uses 100% CPU for about 20 seconds (for effectively doing nothing). This is the case for Sun ire 6 and 7 on windows xp.
>>>>
>>>> On windows 7 the situation is better: javaw uses only about 7 seconds (which is still too much, I guess).
>>>>
>>>> Best regards,
>>>> Peter
>>>>
>
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
More information about the Logback-user
mailing list