Hello Sidd, > I have a need to gather the following information per request:
Do you need to gather them in-program, or is externally sufficient? There are profiling tools out there. If I remember correctly, the IBM JDK has some built-in profiling that can be configured on a per-method basis. If you need the data in your program, see my comments below. > 1. Time taken to lookup the vendor (DNS time) > 2. Time taken to connect > 3. Time taken for first byte download > 4. Time taken for entire xml response download > > Is there a way to do this? > #1 and #2, I am clueless. Implement your own SocketFactory. Perform the DNS lookup manually, trace the time before and after doing that. Then open the socket connection to the IP address instead of the hostname, to avoid a double lookup. Since Java 1.4, connect is an extra method you can call explicitly. Again, trace the time before and after. If you are stuck with Java 1.3, the connect happens when you create the socket object. Trace the time for the "new Socket(...)" call. http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/protocol/ProtocolSocketFactory.html > For #3, I was pondering writing a class inheriting from PostMethod and > overriding > processStatusLine(HttpState state, HttpConnection conn) > and capturing the time taken there. Of course it won't be exactly first > byte, but close. Any ideas? Sounds reasonable. Bytes don't come one by one anyway, you'll get the full status line with the first data packet in most cases. The time for parsing the status line should be negligible compared to network response times. > #4: I pass the response stream to a DOM parser, which in turn consumes it. > So I am not sure how to plug in gathering code here. Trace the time including the DOM parser operation. If the data is processed as it comes in, there's nothing else you could do anyway. If you know for sure that the XML files will be small, you can consider buffering them in memory. Then you can trace the time for reading into the buffer, and pass the buffer to the DOM parser. hope that helps, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
