The dream of every Web site owner is be successful, but an influx of visitors can come at a cost. The more popular your site, the more it’s going to cost you to deliver the pages. PC World reveals techniques for cutting back on the bandwidth without sacrificing quality. As an added bonus, your site’s visitors will enjoy pages that load more quickly and have fewer errors.
Most ISPs charge a fee for hosting a Web site and, depending on the host, you will generally incur a basic fee to cover a fixed amount of bandwidth. For example, you may pay $20 a month and be allocated 500MB of transfers. In most cases, however, if you read the fine print you’ll find that once the limit is reached you’ll be charged a fee per additional megabyte. So, without knowing it, your hosting charges could suddenly skyrocket because your site is doing what you’d hoped — attracting visitors.
Don’t think this is a problem only professional or business sites face. If you operate a free site you probably have tight restrictions — go over your monthly allocation and the free host could simply deactivate your site for anywhere between an hour and a month.
One solution is to try to find a cheaper ISP, but your first step should be a review of your Web pages and a look at how the bandwidth is used by each visitor. Start by analysing your log files. Most log analysis software will give you an average usage per visitor and per page.
A good free program is Alentum’s WebLog Expert Lite (free) or the shareware release with extra features, WebLog Expert ($US75). Both versions are on the cover CD and will help you identify the items being downloaded and how much bandwidth they consume. Some ISPs provide this traffic analysis as part of their service.
A well-designed page with about 300-500 words can look attractive and still only be 30KB on average (depending on graphics). This figure will vary depending on the number of pages a visitor reads, but if your site is hitting 100KB per page there is plenty of room for improvement.
Five steps to take
To minimise bandwidth and reduce the time your pages take to load, you need to ask five key questions:
- Is the HTML lean or full of useless debris?
- Are the pages designed to exploit caching?
- Can some of the graphics be replaced with text?
- Are the graphics optimised for the Web?
- Is someone stealing your bandwidth?
A quick look at many Web pages shows that they are often full of unnecessary details. Start by examining your HTML for comments, excessive paragraph breaks or redundant code. Superfluous tags are common and some are even useless because other tags override their function. For example, Our home.
Meta Tags fields of Meta Description and Meta Keywords can also cause page bloat. In the past, many users thought that loading these fields with masses of keywords would improve search engine rankings. Most search engines ignore these fields, however, and those that still use them will only look at the first seven to 10 words. Loading 50 to 100 words into each field will add about 0.5KB per page.
The visitor’s cache can be your site’s saviour. Each time an element of your page is loaded from their hard drive, instead of your server, it saves you money and speeds your site. There are many advanced tricks available across the Web but a few simple changes can make a difference.
|The price of popularity
It always pays to check the fine print for bandwidth costs — something author Glenn Fleishman found out the hard way. After disappointing sales of his book on Adobe GoLive, Fleishman decided to give it away as a free 23MB download. As you can imagine, the offer was quickly picked up on by sites such as MacCentral as word spread, and in the first day it racked up 10,000 downloads — about 250GB — costing Fleishman $US15,000 in bandwidth charges.
The lesson to be learned from this sorry tale? Ask your host to reduce access to your site if it goes over a certain threshold if you’re worried about this happening to you.
For details of Fleishman’s saga, see the report at www.creativepro.com/storyarchive/newsletter/228.html or get your own copy of the book at www.realworldgolive.com/six (where you can make a donation to the author).
The first place to start is by standardising your graphics. Make sure they are in the same directory and all pages point to the same file at the same location (instead of different copies of the file scattered over your site). For example, your logo may be the same size across your site, but if it is called a different name and is in a different location for each page the user will download each different version instead of just one (that is then reloaded from their cache).
Also look at graphics that perform the same function but are different sizes due to different designers or site upgrades. If your logo is 100 pixels wide on one page and 98 pixels on another, and there is no good reason for the difference, standardise the logo.
Replacing graphics with text
By using tables, colour fields and cascading style sheets (CSS), you can replace many navigation buttons with more economical text. It won’t suit all sites, but if you have 10 navigation buttons at 2-3KB each, replacing them with text will save about 10-30KB per visitor.
A side benefit is that search engines such as Google will now include these words in their indexing (none of the major search engines are able to read the text embedded in graphics files, so these words are not included). This approach can increase your ranking by loading extra keywords onto your page while improving the weighting of these links. Be sure to test different font settings other than those on your computer.
Optimise your graphics
This tip is older than most Web sites, but surprisingly large numbers of people still insist on using the highest quality and colour settings for graphics when they could use far more compact versions without losing quality. Start by checking JPEGs — anything higher that 50 per cent quality is wasted on screen, and 30 per cent is sufficient. Likewise, check the number of colours in your GIF files and try lower values.
Despite all your best efforts, you may find that bandwidth consumption is still high. If you have interesting pictures or videos on your site, other sites may be linking directly to them. The result: they get your image on their site for free and you pay the server costs — an issue known as hotlinking.
This problem has become more severe in recent years due to the rising popularity of blogs and forums. If someone posts direct links to your images and the blog or forum is popular, each time someone visits that page you get a hit. The numbers can range from hundreds to thousands of hits per day, and if the images spread across many forums, this can have a greater impact on your bandwidth.
Why do people hotlink?
There are five major issues:
- Many forums and blogs charge for hosting graphics (probably due to the high bandwidth costs) so the only way for bloggers to include images without paying a fee is to copy the links from other sites.
- Most forums don’t have the option to upload graphics (probably due to bandwidth, copyright, server space and security). Users without Web sites can’t link to their own graphics, so they use other sites.
- Some Web site owners may be reluctant to host the graphics because of copyright problems — in the belief that because the image is not on their site they are not violating copyright. However, it is unlikely that this would work as a legal defence.
- Other site operators may have the same concerns as you and may be linking to your site so that their bandwidth costs are kept down.
- HTML e-mail: some users will create links to your site as part of e-mail formatted in HTML. The sender’s intentions are not usually selfish, but if your logo goes out to thousands of recipients, expect thousands of largely untraceable hits to your server.
Hotlinking is easiest to detect in your log files, but the logs should first be processed with an analysis program such as Weblog Expert. When viewing the results you may notice that a particular image is being requested at a higher rate than the page that is displaying it — evidence of hotlinking. However, the key indicator is your ‘referrer’ logs. If your ISP does not provide this basic information you can request that it be added, or move to another hosting service. From the referrer logs you can see the exact page that requested the image and how many times it was delivered.
To combat hotlinking, you could try firing off e-mails to the hosts of the forums, blogs or Web sites, but this is a lengthy and generally unsuccessful process. In most cases you only discover hotlinking after your bandwidth has been taken. Another option is to change the names of graphics files frequently — a laborious and largely unsuccessful approach.
The most effective way of managing the problem is to use a simple technical solution: block all graphics linking from the outside to your site. You may need some help from your ISP — ask them, because they may already have a solution suitable for your site. If your ISP uses Apache, you are in luck.
By creating a simple .htaccess file, you can control the files that are accessed and which domains you will allow to link (this is handy if you have multiple sites or permitted affiliate sites using your graphics). The file is extremely simple to create and many online sites will generate it for you for free. One of the best is at HTML Basix (www.htmlbasix.com/disablehotlinking.shtml). Fill in a few lines, click the submit button and the code will appear like magic. Don’t forget to read the instructions.
|Put your site on a diet: How you (and your visitors) can benefit:
Most businesses hope to attract a minimum of 5000 visitors a week. If each visitor goes to an average of five pages, you’re looking at 100,000 pages per month. If you are charged 10 cents per megabyte for transfers, each kilobyte you shave off a page, on average, will save 1200MB or $120 per year. Lose 20KB per page and this becomes $2400. More popular sites could see savings in the realm of $10,000.
Your visitor’s experience:
It takes a 56Kbps modem about five seconds to download a 30KB page and possibly 20 seconds for 100KB. Unfortunately, the average visitor is unlikely to wait more than seven to 10 seconds. Keeping your pages under 50KB means keeping visitors at your site.