[ 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-03-31 16:03
Message generated for change (Tracker Item Submitted) made by tbear
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Travis Bear (tbear)
Assigned to: Nobody/Anonymous (nobody)
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
 		    }


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

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

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
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.