
The load on a server can often lead to crashing of websites. You would have noticed how government websites seem to crash on important days etc. Managing the load on the server is important in order to maintain and manage the server load and avoid such issues. |
The more the images on your website, more will be the load on the server. A good way to avoid this is to use CSS code. For example, if you want to get a black background on the website, use the CSS code for the colour.
2. Optimizing Your Images
As mentioned before, images take the most bandwidth on your server. So, it is very important to optimise the images that you put on your website. This can be done by using simple tools like photoshop and others. You should try to use .jpg and .gif files since they are the smallest. You should never use .bmp files.
3. Compress your CSS by shorthand CSS properties
Using CSS Shorthand Properties allows for lesser code in a document, which in turn allows faster download times and easier editing. This is good for any website.
So, instead of writing,
margin-top: 2px;
margin-right: 1px;
margin-bottom: 3px;
margin-left: 4px
Write,
margin: 2px 1px 3px 4px (top, right, bottom, left)
4. Unnecessary HTML Code, Tags and White Spaces
Having unnecessary HTML code, tags and white spaces increases the size of your page. Instead, you can compress the page by removing them. In fact, even removing comments can reduce the load. There are several web tools that allow you to do this very easily.
5. Use AJAX and JavaScript Libraries
Ajax allows a webpage to communicate with a server using JavaScript without reloading the page. This means that similar elements on webpages don't need to be reloaded and the time taken for the process is lesser. Plus, it recuces the server load too.
6. Disable File Hotlinks
Hotlinking refers to the linking of images and downloads from your website to other websites. Websites linking to your images and files will be stealing your bandwidth. You will be the one paying for the bandwidth and your bandwidth load will increase. It's better to stop them from doing this.
7. Compress your HTML and PHP with GZip
The mod-gzip module in Apache can significantly reduce the side of a web page in no time. We spoke about CSS before, in the same way white spaces etc. in HTML can also lead to issues. It is better to compress HTML and PHP using Gzip.
Author : Shivam Kotwalia, CodeKill
No comments:
Post a Comment