[ grinder-Bugs-2980291 ] "resolve host" time incorrect

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #2980291, was opened at 2010-04-01 00:03
Message generated for change (Comment added) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2980291&group_id=18598

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTTP Plugin
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Travis Bear (tbear)
Assigned to: Philip Aston (philipa)
Summary: "resolve host" time incorrect

Initial Comment:
Time spent in HTTP redirects is incorrectly included in the "mean time to resolve host" category.  Normalyy this is not noticeable, but in situations where the initial HTTP request causes the server to do actual work before the redirect is returned to the client, it can make it incorrectly appear that enormous amounts of time are being spent resolving a DNS name, when actually the time is spent elsewhere.

Here is a fix from Bryce Howard:

travis@jtmb:~/projects/grinder/trunk/source/src$ svn st
M       net/grinder/plugin/http/HTTPRequest.java
M       HTTPClient/HTTPConnection.java

travis@jtmb:~/projects/grinder/trunk/source/src$ svn diff net/grinder/plugin/http/HTTPRequest.java 
Index: net/grinder/plugin/http/HTTPRequest.java
===================================================================
--- net/grinder/plugin/http/HTTPRequest.java	(revision 4235)
+++ net/grinder/plugin/http/HTTPRequest.java	(working copy)
@@ -1272,8 +1272,8 @@
       // Stop the clock whilst we do potentially expensive result processing.
       threadContext.pauseClock();
 
-      final long dnsTime = connection.getDnsTime() - startTime;
-      final long connectTime = connection.getConnectTime() - startTime;
+      final long dnsTime = connection.getDnsTime();
+      final long connectTime = connection.getConnectTime();
       final long timeToFirstByte =
         httpResponse.getTimeToFirstByte() - startTime;
 

travis@jtmb:~/projects/grinder/trunk/source/src$ svn diff HTTPClient/HTTPConnection.java
Index: HTTPClient/HTTPConnection.java
===================================================================
--- HTTPClient/HTTPConnection.java	(revision 4235)
+++ HTTPClient/HTTPConnection.java	(working copy)
@@ -3382,6 +3382,7 @@
 
 	if (con_timeout == 0)		// normal connection establishment
 	{
+            long startTime = getTimeAuthority().getTimeInMilliseconds();
 	    if (Socks_client != null)
 		sock = Socks_client.getSocket(actual_host, actual_port);
 	    else
@@ -3390,7 +3391,7 @@
 		InetAddress[] addr_list = InetAddress.getAllByName(actual_host);
                 /** ++GRINDER MODIFICATION **/
                 // capture time for DNS Lookup
-                DNS_time = getTimeAuthority().getTimeInMilliseconds();
+                DNS_time = getTimeAuthority().getTimeInMilliseconds() - startTime;
                 /** --GRINDER MODIFICATION **/
 		for (int idx=0; idx<addr_list.length; idx++)
 		{
@@ -3406,7 +3407,7 @@
                         sock.setKeepAlive(false);
 
 			// capture time for initial connection
-			con_time = getTimeAuthority().getTimeInMilliseconds();
+			con_time = getTimeAuthority().getTimeInMilliseconds() - startTime;
 			/** --GRINDER MODIFICATION **/
 			break;		// success
 		    }


----------------------------------------------------------------------

>Comment By: Philip Aston (philipa)
Date: 2010-12-09 10:59

Message:
There's a problem with the fix when a connect time out is set. See new bug
3132940.

----------------------------------------------------------------------

Comment By: Philip Aston (philipa)
Date: 2010-04-06 21:02

Message:
Fixed for next release:
http://grinder.svn.sourceforge.net/viewvc/grinder?view=rev&revision=4236

----------------------------------------------------------------------

Comment By: Travis Bear (tbear)
Date: 2010-04-05 19:23

Message:
The diffs in the description field look a little jumbled, so I have
attached them separately.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2980291&group_id=18598

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.