You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Michael Mattox <mi...@verideon.com> on 2003/07/03 19:47:16 UTC

Occassional long download times

I'm experiencing something weird and I just want to see if anyone else has
experienced it, and if it may be something I'm doing.  Basically my
application is monitoring 700+ websites every 5 minutes and timing the time
it takes to connect and download.  The main goal is to verify the site is
working, so I don't need exact precision on the times.  Here's some of my
code to time the download:

method = new GetMethod(uri.toString());
method.setFollowRedirects(true);
method.setHttp11(false);
DefaultMethodRetryHandler retry = new DefaultMethodRetryHandler();
retry.setRequestSentRetryEnabled(true);
retry.setRetryCount(3);
method.setMethodRetryHandler(retry);

start = System.currentTimeMillis();
method.execute(state, connection);
msi.setDuration(System.currentTimeMillis() - start);


What I see is that normally I get download times 150ms and then
occassionally (4-5 times a day) I see a download time of 3000ms.  It happens
to the majority of the websites, so I do not believe it's a particular site.
So it must be either my application, or the network.  My application uses a
thread pool and always has multiple threads running (typically 8 at a time
on a 4 CPU machine that's also running tomcat and Postgres), and I've seen
that at exactly the same time a website has a 3000ms download time several
others have normal 150ms times.  So this seems to rule out the network.  I
set my threads to be all MAX_PRIORITY to minimize the interruptions.  Are
there any other explanations?  Any ideas what I can do about it?  My current
thought is to put in some code to say if the download time is more than 10x
the previous time then repeat the download to make sure.  This way our
customers wouldn't see the huge spike in the numbers, but at the same time
if that spike really should be there I don't want to cover it up.

Thanks,
Michael



Re: Occassional long download times

Posted by Michael Becke <be...@u.washington.edu>.
Yes, the instructions for using the logging do not apply when Log4j is 
being used.  In this case you must configure logging using the standard 
Log4j mechanism.  If you are using property configuration it would look 
something like:

log4j.logger.httpclient.wire=DEBUG, SOME_APPENDER

Mike


Michael Mattox wrote:
> I've tried to turn the wire logging on but can't get it to work.  I pasted
> the code to set the system properties but that doesn't work.  Is it possible
> to use the wire log with Log4J?
> 
> Thanks
> Michael
> 
> 
>>-----Original Message-----
>>From: Eric Johnson [mailto:eric@tibco.com]
>>Sent: Monday, July 07, 2003 3:23 PM
>>To: Commons HttpClient Project
>>Subject: Re: Occassional long download times
>>
>>
>>Michael,
>>
>>You might try turning on the wire and/or trace logging (which sounds
>>like it might generate a lot of data), but it would also tell you
>>exactly where the delay occurs.
>>
>>Knowing where the culprit occurs would provide additional detail that
>>might clearly identify whether the problem lies with HttpClient or the
>>network.
>>
>>-Eric.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
> 


Re: Occassional long download times

Posted by Eric Johnson <er...@tibco.com>.
See:

http://archives.apache.org/eyebrowse/ReadMsg?listName=commons-httpclient-dev@jakarta.apache.org&msgId=754530

You'll have to configure Log4J, which I do not know well, but it should 
be straightforward to do in conjunction with the httpclient logging guide.

-Eric.

Michael Mattox wrote:

>I've tried to turn the wire logging on but can't get it to work.  I pasted
>the code to set the system properties but that doesn't work.  Is it possible
>to use the wire log with Log4J?
>
>Thanks
>Michael
>
>  
>
>>-----Original Message-----
>>From: Eric Johnson [mailto:eric@tibco.com]
>>Sent: Monday, July 07, 2003 3:23 PM
>>To: Commons HttpClient Project
>>Subject: Re: Occassional long download times
>>
>>
>>Michael,
>>
>>You might try turning on the wire and/or trace logging (which sounds
>>like it might generate a lot of data), but it would also tell you
>>exactly where the delay occurs.
>>
>>Knowing where the culprit occurs would provide additional detail that
>>might clearly identify whether the problem lies with HttpClient or the
>>network.
>>
>>-Eric.
>>    
>>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>
>  
>



RE: Occassional long download times

Posted by Michael Mattox <mi...@verideon.com>.
I've tried to turn the wire logging on but can't get it to work.  I pasted
the code to set the system properties but that doesn't work.  Is it possible
to use the wire log with Log4J?

Thanks
Michael

> -----Original Message-----
> From: Eric Johnson [mailto:eric@tibco.com]
> Sent: Monday, July 07, 2003 3:23 PM
> To: Commons HttpClient Project
> Subject: Re: Occassional long download times
>
>
> Michael,
>
> You might try turning on the wire and/or trace logging (which sounds
> like it might generate a lot of data), but it would also tell you
> exactly where the delay occurs.
>
> Knowing where the culprit occurs would provide additional detail that
> might clearly identify whether the problem lies with HttpClient or the
> network.
>
> -Eric.




Re: Occassional long download times

Posted by Eric Johnson <er...@tibco.com>.
Michael,

You might try turning on the wire and/or trace logging (which sounds 
like it might generate a lot of data), but it would also tell you 
exactly where the delay occurs.

Knowing where the culprit occurs would provide additional detail that 
might clearly identify whether the problem lies with HttpClient or the 
network.

-Eric.

Michael Mattox wrote:

>I'm experiencing something weird and I just want to see if anyone else has
>experienced it, and if it may be something I'm doing.  Basically my
>application is monitoring 700+ websites every 5 minutes and timing the time
>it takes to connect and download.  The main goal is to verify the site is
>working, so I don't need exact precision on the times.  Here's some of my
>code to time the download:
>
>method = new GetMethod(uri.toString());
>method.setFollowRedirects(true);
>method.setHttp11(false);
>DefaultMethodRetryHandler retry = new DefaultMethodRetryHandler();
>retry.setRequestSentRetryEnabled(true);
>retry.setRetryCount(3);
>method.setMethodRetryHandler(retry);
>
>start = System.currentTimeMillis();
>method.execute(state, connection);
>msi.setDuration(System.currentTimeMillis() - start);
>
>
>What I see is that normally I get download times 150ms and then
>occassionally (4-5 times a day) I see a download time of 3000ms.  It happens
>to the majority of the websites, so I do not believe it's a particular site.
>So it must be either my application, or the network.  My application uses a
>thread pool and always has multiple threads running (typically 8 at a time
>on a 4 CPU machine that's also running tomcat and Postgres), and I've seen
>that at exactly the same time a website has a 3000ms download time several
>others have normal 150ms times.  So this seems to rule out the network.  I
>set my threads to be all MAX_PRIORITY to minimize the interruptions.  Are
>there any other explanations?  Any ideas what I can do about it?  My current
>thought is to put in some code to say if the download time is more than 10x
>the previous time then repeat the download to make sure.  This way our
>customers wouldn't see the huge spike in the numbers, but at the same time
>if that spike really should be there I don't want to cover it up.
>
>Thanks,
>Michael
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>
>  
>



Re: Occassional long download times

Posted by Tony Bigbee <ab...@mitre.org>.
Depending on the OS (and the configuration of the OS thread scheduler), 
I've seen multithreaded Java apps receive uneven CPU among threads of 
the JVM (and multiple JVMs too).  Multiple CPUs is
no guarantee that they will be used appropriately if the thread 
scheduler is configured "wrongly."

And it happens even under non-severe loading conditions.  You say 
"typically 8" but what are the upper bounds of # of active threads?

I'm just tossing out an idea, but the fact that you see the delays only 
4-5 times a day suggests that thread scheduling is not the issue.

I think the only way you can really be sure that the delay/download 
time is caused by external factors (remote webserver saturation or 
network issue) is to run something like Ethereal or tcpdump.  That would
tell you when the initial request goes out over the wire and when you 
receive a response back.  That's about as close to a smoking gun as I 
can imagine.

Another thing you could do is to include a webserver on your LAN as 
part of the polling and see if you ever get a significant delay over an 
extended period of time.
Tony

On Thursday, July 3, 2003, at 01:47 PM, Michael Mattox wrote:

> What I see is that normally I get download times 150ms and then
> occassionally (4-5 times a day) I see a download time of 3000ms.  It 
> happens
> to the majority of the websites, so I do not believe it's a particular 
> site.
> So it must be either my application, or the network.  My application 
> uses a
> thread pool and always has multiple threads running (typically 8 at a 
> time
> on a 4 CPU machine that's also running tomcat and Postgres), and I've 
> seen
> that at exactly the same time a website has a 3000ms download time 
> several
> others have normal 150ms times.  So this seems to rule out the 
> network.  I
> set my threads to be all MAX_PRIORITY to minimize the interruptions.  
> Are
> there any other explanations?  Any ideas what I can do about it?  My 
> current