Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'diagnostic command' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
diagnostic command
Authored by: hayne on May 05, '05 02:03:47PM
Before even thinking about implementing this hint, you should find out exactly what it is that is slowing down your web browsing. Sometimes it is the DNS, but sometimes it is the server (nothing you can do about that), and sometimes it is the browser.

To eliminate the browser as a source of slowness, you can download the raw HTML via a command-line tool that does all the things that a browser does - except it doesn't display the page and so issues of graphics and rendering speed are factored out. The 'curl' program is one such command-line tool that you can use.

It turns out that 'curl' has some built-in diagnostics that are very useful for debugging web browsing troubles. The following command (copy & paste it into a Terminal window, and press Return) will show you the times taken for the various steps needed to retrieve a page from a given URL. This command is supposed to be all on one line but I have broken it up onto two lines to make it fit better on the page. You need to use the actual URL in place of "the_URL_of_the_web_page":


/usr/bin/curl the_URL_of_the_web_page -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect}
pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\n"
You could make this into a convenient one-word command as a Bash function by putting the following in your ~/.profile file (again this is broken into two lines but is supposed to be all on one line):

debug_http () { /usr/bin/curl $@ -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect}
pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\n" ; }
The first time reported is the time for the DNS query. If that time is small, then this hint definitely won't be of help.

[ Reply to This | # ]