Syber Blog - Your Source 4 All Web 2.0

10 Ways to Reduce Server Load and Save Bandwidth

Posted by Syberplanet on March 11th, 2009 - 3,162 views

There are many reasons by which you can face website downtime. May be due to the host server’s condition (for example, if it’s a shared server, the other web sites running on the same server will definitely slow things down) or your website configuration or maybe due to your code. A server could be crashed by dozens of reasons, with each reason having several possibilities, with each possibility having dozens of solutions committing their existence. This could impose a huge amount of confusion for a small group of developers.

One thing we’ve noticed while managing few websites – in many cases they aren’t the fastest sites on the world-wide-web. While much of this may be due to the host server’s configuration, some of the performance issues are caused by things you can control.

There are few thing you need to keep in mind before exploring these tips that many times it’s possible that few of the mentioned tips not work for your one particular website that does not mean it’s not going to work with any another of your projects.

Use CSS Text Instead of Images

Tips to Reduce Server Load and Save Bandwidth
Images make your Web pages slower and consumes a lot of bandwidth of your server. Instead of using a background image, use the CSS code. For example if you want to use plain red background in your website then use CSS code background-color:#F00 instead of a red-bg.jpg. With CSS, you can set the background color or background image of any CSS element.

These is a nice tutorial on about how wisely you can use your background images to reduce server load.

Optimizing Your Images

Tips to Reduce Server Load and Save Bandwidth
More than half of the bandwidth on most websites is used by images and optimizing images is the best way to improve the bandwidth used on your web server. Optimize your images for the internet and shrink their sizes as well, never use bitmap files (.bmp) as they are HUGE (mostly in MBs). You should use jpeg (.jpg) or gif (.gif) files for images as these are optimized for the internet. A good rule of thumb is to strive for no one image being larger than 10 Kb. This is especially hard with animations, but if you can do it, you’ll notice remarkable difference in bandwidth used of your server. There are various image conversion programs/softwares available all over the internet and there are various optimization programs too, be sure to get an optimization program that will be able to retain the images quality while drastically reducing its size.

If you’re using Photoshop, use can compress your images by ‘Save for Web & Devices’ (Alt+Shift+Ctrl+S) option to optimize it for minimum bandwidth. When you have an image with lots of colours, you should go for JPEG or PNG. Play around with the quality to change the file size.

Check out the Seventh Georgia Tech GVU WWW survey as quoted in “How Much is Too Much”.

Compress your CSS by shorthand CSS properties

Tips to Reduce Server Load and Save Bandwidth
CSS files can be pretty big, with lots of useless breaks and spaces. CSS shorthand properties are great! They’re a great way to reduce the amount of code contained in a CSS document, allowing for faster download times and easier editing. For example you can use
margin: 2px 1px 3px 4px (top, rightright, bottombottom, left)

…instead of

margin-top: 2px;
margin-right: 1px;
margin-bottom: 3px;
margin-left: 4px

There is a cool article written by about CSS shorthand properties.
You can also use the CSS Compressor from to reduce the size of CSS file and unnecessary breaks and spaces.

Remove Unnecessary HTML Code, Tags and White Spaces

Tips to Reduce Server Load and Save Bandwidth
You can compresses your page size by removing unnecessary white space in your HTML files even remove comments (if not absolutely necessary) because every extra charecter means extra page size. Whether you use visual HTML editors or notepad, your HTML code contains unnecessary stuff: unneeded spaces, returns, meta tags, default values in HTML elements, etc. They will make your web pages bigger, without serving any real purpose. Bigger web pages takes longer to load, increases data traffic of your web server, and waste precious bandwidth.

Wordoff is simple and useful web tool that lets you remove unnecessary tags and styles from HTML code. Most of us have to clean up the HTML code manually in our working life. This web tool definitely help all of us in that situation and you also find this worth bookmarking.

Use AJAX and JavaScript Libraries

Tips to Reduce Server Load and Save Bandwidth
AJAX is a technology for a web page to communicate with a server using JavaScript without reloading the page. In general, related pages on a website consist of much content that is common between them. Using traditional methods, that content would have to be reloaded on every request. However, using Ajax, a web application can request only the content that needs to be updated, thus drastically reducing bandwidth usage and load time.

If you want to read further about techniques that you can use to save your bandwidth by take advantage of Google’s AJAX Libraries API, published a article on this topic.

Disable File Hotlinks

Tips to Reduce Server Load and Save Bandwidth
Hot Linking term is linking images or downloads from your website to other website(s). Basically the images are on your website and other websites just links image tags to your website, hence stealing your bandwidth. If people are ‘hotlinking’ to your image files, they are using your bandwidth which you will ultimately pay for.

You can stop this from happening by placing a ‘.htaccess’ file in the folder where your images are stored. This will only allow requests from your own pages to display the images – anyone linking to them from outside of your website, or any website you choose, will have the ‘red x’ instead of the image.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)? [NC]
RewriteRule \.(jpeg|jpg|gif|png)$ - [F] wrote a nice tutorial to prevent hotlinking using the .htaccess file.
You can also use .htaccess generator to disable hotlinking provided by HTMLBasix.

Compress your HTML and PHP with GZip

Tips to Reduce Server Load and Save Bandwidth
Just like the CSS, your HTML can contain a lot of whitespaces and useless breaks. If you are using PHP then you can use mod_gzip for Apache to compress your content. Mod_gzip is a module for apache (existing on both windows and Unix/Linux versions of apache) that can significantly lower the size of a webpage on the fly, when it is requested by a browser that can understand compressed content (almost all modern browsers do support compression). Remember, the great thing is that the compression on the server is activated only if the browsers requests compressed content, in case the browser does not understand compressed content or does not request for it, the server simply servers plain, uncompressed content!

The easiest is way is by using a .htaccess file. I would recommend using .htaccess method because it’s very simple to implement and by .htaccess file you can further configure server configurations. Now to enable gzip compression add the following line to your .htaccess file.
php_value output_handler ob_gzhandler

Or in you can insert order for the PHP compression to work, you should insert the following line on the header of your webpages, on the top that is of your page:

< ?php ob_start("ob_gzhandler");?> wrote a tutorial about how to enable gzip compression.

Use free images/file webhosting website to host your files

Tips to Reduce Server Load and Save Bandwidth
If you want to share (big) files and not let your bandwidth effect by it, host the file on free or paid image/file hosting websites such as Flickr, Pikasa, PhotoBucket, ImageShack, and Host the file and place the download link on your own blog or website. This will save a tremendous amount of bandwidth on your server. Before doing this, however, make sure you are permitted by your service provider to do that.

Avoiding Attachments Whenever Possible

Tips to Reduce Server Load and Save Bandwidth
If the file you’re about to host on your server can be found elsewhere on the net, it maybe better to use the link of that location rather than hosting a copy of the file itself on your server. It will without any doubt cost you extra bandwidth but also increate server load. If nothing else, this will save you some time because you don’t need to upload file on your system.

Website Caching

Tips to Reduce Server Load and Save Bandwidth
Caching is a method of retrieving data from a ready storage (cache) instead of using resources to generate it every time the same information is needed. Enable caching on your website if it’s not dynamic, will allow the end users computer to read from your server once in a while, the rest of the times it will read from its own backup copies until they expire. Another good idea is to cache your website but you might want to set an expiry date in the HTTP headers so expire headers tell the browser how long it should keep the content in cache. Most of the images on your site never change and it is good idea to keep them cached locally.

Caching with mod_headers

# 1 YEAR
<filesmatch \.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$="">
Header set Cache-Control "max-age=29030400, public"
# 1 WEEK
<filesmatch \.(jpg|jpeg|png|gif|swf)$="">
Header set Cache-Control "max-age=604800, public"
# 3 HOUR
<filesmatch \.(txt|xml|js|css)$="">
Header set Cache-Control "max-age=10800"
<filesmatch \.(html|htm|php|cgi|pl)$="">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"

Caching with mod_expires

ExpiresActive On
ExpiresDefault A0
# 1 YEAR
<filesmatch \.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$="">
ExpiresDefault A9030400
# 1 WEEK
<filesmatch \.(jpg|jpeg|png|gif|swf)$="">
ExpiresDefault A604800
# 3 HOUR
<filesmatch \.(txt|xml|js|css)$="">
ExpiresDefault A10800"

Source : Instant Shift

If you enjoyed this post, make sure you subscribe to our RSS feed!

4 Responses to “10 Ways to Reduce Server Load and Save Bandwidth”

  1. Hello! Just wanted to say great website. Keep up the good work!

  2. Thanks for the great info.Very nice blog layout. Easy on the eyes. Thanks and happy holidays.

  3. Brilliant, cheers, I will visit again later!

Leave a Reply

Advertise on Syber Blog
Earn $$ with WidgetBucks!