Improve Site Performance Increase Site Traffic Monitor Site Uptime Webmaster Resources NetMechanic Home Looking For Help? Partner Programs Privacy Policy Contact Us Press Room
NetMechanic Home LOGIN | HELP | ABOUT US | PRODUCTS | SITE MAP
NetMechanic Menu
Over 52 Million Web Pages Tested!     
 
search engine submission service.
Search for:


Your Email:

I would like to receive my newsletter in:
HTML format
Text format


search engine listing.
Volume 8 (2005)
   September
   June
   April
   March
   January

Volume 7 (2004)
   November
   September
   July
   June
   May
   April
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 6 (2003)
   December
   November (Part 2)
   November
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 5 (2002)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 4 (2001)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 3 (2000)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June
   May
   April
   March
   February
   January

Volume 2 (1999)
   December
   November
   October
   September
   July
   June
   May
   April
   March
   February
   January

Volume 1 (1998)
   December
   November
   October
   September

 
Updated October 22, 2001

Load Time Tip:
Use a Trailing Slash on Directory URLs

by Tom Dahm,
Chief Operations Officer,
NetMechanic, Inc.

  
June 2001
Vol. 4, No. 11
 • HTML Tip
 • Promotion Tip
 • Load Time Tip
  

Here's a simple tip to get a little more performance from your Web server: use a trailing slash on your directory URLs. This small addition decreases page load time by reducing the number of times a visitor's browser has to talk to your Web server.

Default HTML Files

If you have much experience with HTML, then you're probably familiar with default HTML files for directories. Suppose you have a directory on your server called "/news" that contains several HTML files: the Web server will expect that directory to also contain a default HTML file.

The name of this directory default file depends on your server configuration. On most Web servers the default file is named "index.html," though it may also be named "index.htm," "default.html," or even "homepage.html."

If a URL pointing to the "/news" directory doesn't specify an HTML file, then server will serve the default file instead. So a request for the URL:

http://www.mysite.com/news

will actually serve the page located at this URL:

http://www.mysite.com/news/index.html

So far, so good. This was something you probably learned the first time you published your Web pages to a server.

Make Specific Requests

But what you may not realize is that how you reference the "/news" directory can put an extra load on your Web server. Here's how.

When a URL references "/news," a Web browser isn't sure whether this is a directory on a Web server or a file residing on the server. So the browser submits a request to the server for "/news." The Web server checks its file system and replies back to the browser: "I believe you're mistaken. You don't want a file called 'news,' you want the directory called 'news.'"

The browser replies: "Oh, that's right. Could I please have the directory '/news/?'" Only then does the Web server send the correct file.

You can see this exchange between the browser and the Web server if you look at the server's log files. The example below shows a browser first asking for the URL http://www.netmechanic.com/news."

Notice the number "301" listed on this first line. That's the HTTP response code sent back to the browser. A 301 code is a "permanent redirect," which is the server's way of telling the browser that it needs to look for the file elsewhere (In the actual reply sent back to the browser, the server will tell it where to look. But you won't see this redirect instruction listed in the server log.)

1: 216.180.71.96 - - [26/May/2001:13:28:59 -0400] "GET
/news HTTP/1.1" 301 328 "-" "Mozilla/4.0..."

2: 216.180.71.96 - - [26/May/2001:13:29:00 -0400] "GET
/news/ HTTP/1.1" 200 21 "-" "Mozilla/4.0..."

The second line shows the browser following the server redirect a second later, this time asking for the "/news/." Now the server responds with an HTTP status code of 200, which means "ok."

This dialogue is completely unnecessary. You can avoid it entirely adding a trailing slash to the URL. In other words, your URL would look like this:

http://www.mysite.com/news/

Now the browser will be served the correct file after a single request.

Reduce The Load Time Of Every Page

How much will this tip improve your page load time? For most Web browsers, the impact on page load time will be almost imperceptible. Other techniques like reusing images, breaking up tables, and slicing images have much more impact. For older browsers, though, this can improve load time performance by perhaps two seconds.

Older browsers use Version 1.0 of the HTTP protocol. Under HTTP/1.0, the Web browser opened a separate network connection a Web server each time it submitted a request. If a Web page contained four graphics, the browser would submit five requests (one for the HTML file, and four for the graphics). Each request required a separate connection to the server, which typically takes about two seconds to establish (browser tended to be multithreaded, opening several connections in parallel).

For these old browsers, the server redirection required the browser to open another connection to the server, and added a two-second delay to the page loading.

Newer browsers use Version 1.1 of the HTTP protocol. Under HTTP/1.1, browsers keep connections to the Web server alive and ask for several objects in turn. This change improved page-loading performance and reduced the load on the Web server, since the server spent less time responding to requests for new connections.

Avoid Future Problems

So for newer browsers, the penalty is only a fraction of a second. However, adding the "/" reduces the load on your Web server by removing an unnecessary page request. This reduces the load time of every page being served.

If a server is under heavy load, the price of servicing these unnecessary requests could be significant. So even if you don't see an immediate benefit by changing the way you write URLs, this trivial addition can help you avoid a future crisis.

If you run your own server, consider turning off reverse DNS lookup for a little added performance.

Web site crises happen more often than you think. In the past year, 41% of servers have experienced substantial downtime. Do you know how quickly your server responds to requests or how often it's completely down? NetMechanic's Server Check Pro can tell you. We'll monitor your server's performance 24 hours a day and alert you to problems.



Rate This Tip:
Not Useful Useful Very Useful   
 
NetMechanic Tools
HTML Toolbox
Browser Photo
Server Check
Search Engine Starter
Search Engine Tools
GIFBot
Newsletter
HTML Tutorial and Tips
Search Engine Tutorial
Accessibility Information
Browser Problem Tutorial

Company Info
Products
About Us
Contact
Advertise
Link To Us
Jobs
Privacy Policy
Partner Programs
Press Room
RSS Feed
Support
 



Powered by Overture!

 
     
 
   
 
     


Keynote Home
Copyright © 1996-2007,
Keynote NetMechanic
All rights reserved.