You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Tony Poppleton <to...@wanadoo.fr> on 2009/11/28 18:01:31 UTC

Log creation appears to be a slowdown

Hi,

I have run a JProfiler on my application that uses HttpClient to send 
requests every 10 milliseconds.  One interesting part of the results is 
that the Log creation is actually consuming about 5% of the time, which 
is significant considering I am trying to squeeze the most performance 
out.  For example:

    public class ClientParamsStack extends AbstractHttpParams {
        private final Log log = LogFactory.getLog(getClass());

I have always used static loggers myself, which avoid this problem, so I 
did a tiny bit of research 
(http://wiki.apache.org/jakarta-commons/Logging/StaticLog) and 
apparently static isn't always the right choice.

Is there anything I can do to prevent the log creation from being a 
slowdown, short of checking out the source tree and creating my own 
custom patch?

I haven't investigated fully yet, but ClientParamsStack class seems to 
be the main culprit, so is there any way I can set it to use my own 
custom implementation of this?

Many thanks,
Tony

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Log creation appears to be a slowdown

Posted by Tony Poppleton <to...@wanadoo.fr>.
Hi Oleg,

Thanks for doing further investigation.

As requested, I have just logged JIRA 
https://issues.apache.org/jira/browse/HTTPCLIENT-895

Cheers,
Tony

Oleg Kalnichevski wrote:
> On Mon, 2009-11-30 at 14:27 +0100, Oleg Kalnichevski wrote:
>   
>> On Sat, 2009-11-28 at 17:01 +0000, Tony Poppleton wrote:
>>     
>>> Hi,
>>>
>>> I have run a JProfiler on my application that uses HttpClient to send 
>>> requests every 10 milliseconds.  One interesting part of the results is 
>>> that the Log creation is actually consuming about 5% of the time, which 
>>> is significant considering I am trying to squeeze the most performance 
>>> out.  For example:
>>>
>>>     public class ClientParamsStack extends AbstractHttpParams {
>>>         private final Log log = LogFactory.getLog(getClass());
>>>
>>> I have always used static loggers myself, which avoid this problem, so I 
>>> did a tiny bit of research 
>>> (http://wiki.apache.org/jakarta-commons/Logging/StaticLog) and 
>>> apparently static isn't always the right choice.
>>>
>>>
>>> Is there anything I can do to prevent the log creation from being a 
>>> slowdown, short of checking out the source tree and creating my own 
>>> custom patch?
>>>
>>> I haven't investigated fully yet, but ClientParamsStack class seems to 
>>> be the main culprit, so is there any way I can set it to use my own 
>>> custom implementation of this?
>>>
>>>       
>> Tony,
>>
>> If log creation does indeed have such an adverse effect on performance,
>> I would very much rather prefer to fix the problem in the library
>> itself. If you are reasonably sure performance can be improved by
>> eliminating certain log instances, please remove them and submit a patch
>> for inclusion into the official code base.
>>
>> Cheers
>>
>> Oleg  
>>
>>     
>
> Hhhm. I get good 5 to 7% performance improvement by eliminating Log
> instances in ClientParamsStack and DefaultHttpRequestDirector classes. I
> never imagined the performance penalty of the Log lookup operation was
> so significant. 
>
> Tony,
>
> Could you please open an issue in JIRA for this problem?
>
> Oleg
>
>
>   
>>> Many thanks,
>>> Tony
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>>
>>>       
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>     
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
> ---------------------------------------------------------------------------------------
> Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
> Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>   

Re: Log creation appears to be a slowdown

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2009-11-30 at 14:27 +0100, Oleg Kalnichevski wrote:
> On Sat, 2009-11-28 at 17:01 +0000, Tony Poppleton wrote:
> > Hi,
> > 
> > I have run a JProfiler on my application that uses HttpClient to send 
> > requests every 10 milliseconds.  One interesting part of the results is 
> > that the Log creation is actually consuming about 5% of the time, which 
> > is significant considering I am trying to squeeze the most performance 
> > out.  For example:
> > 
> >     public class ClientParamsStack extends AbstractHttpParams {
> >         private final Log log = LogFactory.getLog(getClass());
> > 
> > I have always used static loggers myself, which avoid this problem, so I 
> > did a tiny bit of research 
> > (http://wiki.apache.org/jakarta-commons/Logging/StaticLog) and 
> > apparently static isn't always the right choice.
> > 
> >
> > Is there anything I can do to prevent the log creation from being a 
> > slowdown, short of checking out the source tree and creating my own 
> > custom patch?
> > 
> > I haven't investigated fully yet, but ClientParamsStack class seems to 
> > be the main culprit, so is there any way I can set it to use my own 
> > custom implementation of this?
> > 
> 
> Tony,
> 
> If log creation does indeed have such an adverse effect on performance,
> I would very much rather prefer to fix the problem in the library
> itself. If you are reasonably sure performance can be improved by
> eliminating certain log instances, please remove them and submit a patch
> for inclusion into the official code base.
> 
> Cheers
> 
> Oleg  
> 

Hhhm. I get good 5 to 7% performance improvement by eliminating Log
instances in ClientParamsStack and DefaultHttpRequestDirector classes. I
never imagined the performance penalty of the Log lookup operation was
so significant. 

Tony,

Could you please open an issue in JIRA for this problem?

Oleg


> 
> > Many thanks,
> > Tony
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Log creation appears to be a slowdown

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2009-11-28 at 17:01 +0000, Tony Poppleton wrote:
> Hi,
> 
> I have run a JProfiler on my application that uses HttpClient to send 
> requests every 10 milliseconds.  One interesting part of the results is 
> that the Log creation is actually consuming about 5% of the time, which 
> is significant considering I am trying to squeeze the most performance 
> out.  For example:
> 
>     public class ClientParamsStack extends AbstractHttpParams {
>         private final Log log = LogFactory.getLog(getClass());
> 
> I have always used static loggers myself, which avoid this problem, so I 
> did a tiny bit of research 
> (http://wiki.apache.org/jakarta-commons/Logging/StaticLog) and 
> apparently static isn't always the right choice.
> 
>
> Is there anything I can do to prevent the log creation from being a 
> slowdown, short of checking out the source tree and creating my own 
> custom patch?
> 
> I haven't investigated fully yet, but ClientParamsStack class seems to 
> be the main culprit, so is there any way I can set it to use my own 
> custom implementation of this?
> 

Tony,

If log creation does indeed have such an adverse effect on performance,
I would very much rather prefer to fix the problem in the library
itself. If you are reasonably sure performance can be improved by
eliminating certain log instances, please remove them and submit a patch
for inclusion into the official code base.

Cheers

Oleg  


> Many thanks,
> Tony
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org