You might have heard many times that a website has crashed, a site is down, a website is inaccessible etc. When this kind of faults occur, usually the reason is that the server had too much load and it had crashed. In this article we determine what is a server, managing server and load balancing on the server. Managing server is very important because the seamless functioning of a website is dependent upon an efficiently functional web server.
What is a Web Server?
A web server is a very powerful computer with a strong processer and is used to host websites on a World Wide Web and process client requests. Whenever we type in the address of a website, a request is sent to the web server through the HTTP which is the most commonly used web protocol. The request is sent by the browser to the server where the website is located. The servers sends the website back to the client.
A server is tuned to handle a number of requests. It can handle between 2 to 80000 concurrent client requests. By default it is between 500 and 1000) However when there are too many requests at a time, the server will crash. You can say that if the server can carry out so many concurrent requests why does it crash. You see, there are millions of users using the internet all the time. When a webpage becomes viral there will be millions of concurrent requests to it from all over the world. And if there is no proper load balancing, the server will crash and the site goes down.
If a website is crashing often, then it is disastrous for the repute of the website. People will stop visiting the site if it is prone to crashes. So it is of utmost importance that proper load balancing is done for your website. There are a number of tricks and techniques that are followed in order to prevent the server from crashing. Managing server in a proper way can prevent the crashes from occurring.
Reasons of server management failure
Here are some top reasons of why the server fails
- Massive and sudden increase in the web traffic on a relatively normal load site where such an amount of traffic is unprecedented for example like the Slashdotting effect.
- Distributed denial of Service or the DoS attack. It may be intentional or due to some malicious activity.
- Computer Worms can cause crashing of servers because millions of effected computers increase the traffic.
- The XXS worm which is also called the cross site scripting virus is sometimes responsible for malicious access traffic causing server failure.
- Internet slows downs causing the requests to be served very slowly thus the server limits are reached.
- Web server machine breaks down partially or completely because of maintenance, hardware replacement etc.
These are just some of the many reasons that are responsible for server management failure.
How to protect server from crashing due to load?
There maybe many ways in which the server can be protected from crashing. If there are viruses and worms or malicious content then that is difficult to handle, but common issues are heavy website, bandwidth limitations and quick accessibility can be controlled beforehand. Here are few techniques of managing server load in an optimum way.
Managing Server Load in an Optimum way
Use CSS instead of images wherever possible.
Whenever it is possible use CSS and do not use images. Especially instead of using a large images or applying tiles to a pattern, it is much better to use a light background color. It will not only save your website from becoming heavy due to the large image on every page but also if for some reason the image cannot be displayed the site will look ugly however the color will be displayed in any case. For example a simple CSS code background-color:#F00 will give you a red background instead of using an image.
Optimize your images for managing server
Nowadays in most of the websites the images take atleast half the bandwidth or even more. So to make the website efficient, it is very important optimize your images. If there are many images on your website, then this step will greatly increase the performance. One simple tip is to avoid using .bmp images and use .jpeg and .gif files instead. The reason is that .bmp files are very huge in size. On the other hand the .gif files as well as .jpg files are optimized for the use on internet. If you reduce the size of all images to below 10 KB, you can make the website much more efficient. There will be marked difference. You can search for any free software for image optimization and download it for optimizing your images.
Reduce to CSS shorthand properties
CSS files can be extra ordinarily big. After completion make sure you check all your CSS files and clear all the extra spaces and blank lines from it. Another space saving technique are the great CSS shorthand properties. They are great for coders because they save a lot of time and are great for site owners because they save space. If you are having your site designed you must stress upon the coders to use CSS shorthand properties. If you already have a site, then you can update the long CSS properties format for the short one.
These four lines
1 margin-top: 2px;
2 margin-right: 1px;
3 margin-bottom: 3px;
4 margin-left: 4px
can be replaced by this one single line of code
margin: 2px 1px 3px 4px
it will have the same effect as the above code . This might seem a small space saver but do you know every element has a margin property an on your one webpage there might be a hundred unique elements. How many spaces can you save by replacing the four line code with one line in every case? You do the math.
4. Clean up the HTML
Just like the CSS you can clean up the HTML also to save the space. HTML ends up having a lot of blank spaces. After writing the code it is a good practice to clean it up. Sometimes there are useless tags and elements added. This is the case when more than one people are working on a page of code or you are using auto code completion editor. Once the code is cleaned up you will see how much space is saved.
5. Hotlink Prevention
Prevent other sites from entering hotlinks to your images. Hotlinks are links to the images placed on your webpage. When the sites hotlink to your images, you end up paying for more bandwidth then required for your own webpage. You pay for the bandwidth that the other websites that have hotlinks to your page are using. So it always advisable to hotlink proof your website. It can be done with a simple step. Just add ‘.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.
6. Use free image hosting sites
Here is one great tip. If you have large images that you want to display and limited bandwidth, well why not share the load by hosting the image files on some free webhosting website. Or even if you have to pay, dividing the share is great for web performance. There are a number of such sites like Picassa, RapidShare, photobucket, Flickr etc.you can easily use any of these sites to off load your weight on them. It is a simple step but will be greatly helpful to your page.
7. Switch on the website caching
This is another method that will save you a lot of bandwidth and is great for managing server. Cache is a ready storage where data is locally available. So save the data when you website is requested. Of course only static data can be cached. You can cache the images in your headers or home page and favicon. However it is a good idea to put an expiry date on the cached memory so that it will be updated after a time. Even if you thing there is some data that will never change, still put expiry on it because you never know you might want to change it after sometime.
8. Using CSS Sprites of take the load off server
You might have heard about CSS sprites, but very seldom people use it and do not realize that it can be great for optimum server management. CSS sprites help you by combining all the background images and making them one. Then this one image is placed and positioned by CSS. When there are many images combined to form the background it becomes easier to handle them and work with them. Instead of formatting each one separately, you just format one.
9. Reduce your script requests for managing server in optimum way
This tip needs deep analysis and can reap good results if used properly. There are many script requests on your each html page. See wherever you can combine the CSS files together. When you can combine them together, it will reduce the number of HTTP requests.
10. Zero tolerance to ‘No Page Found’ or 404 Errors
There should be absolutely no 404 Errors. It is very annoying when you encounter a 404 Error. Besides that it is a loss of a precious HTTP request. The server will check through all the pages of your website before it can safely say that there is no page of the name that you have requested available on the server. So why waste the request even when there is no result to show. That is why make sure there are no 404 errors on your website.
11. Choose your web host wisely for managing server properly
It is okay to pay a little more and give good service to your visitors then paying a little less and making your readers feel annoyed by waiting for a long time to get your webpage loaded. Your host is very important because the traffic of your website is depended on the host services, after the content. If good content can get you good Google ranking then and page views, good service from the host can make the visitors become a regular to your webpage.
12. Use cloud platform for hosting large sites with lot of traffic
More and more websites are moving to cloud service providers for the hosting of their website. Cloud is a great and reliable platform to host your website. Google, Amazon and Microsoft all provide cloud service. Cloud platform may be good for you if you are expecting your traffic to increase exponentially. It is very easy to scale up your website through cloud. Cloud is a shared platform where many pages or applications might be using resources shared over the internet.
read more about the cloud Cloud Computing for beginners part 1
13. Link CSS files instead of importing them
Instead of importing the CSS files into your main page, it is advisable to link them up. This will greatly speed up the process of processing the request and good server management practice.
14. Style sheets at the top an scripts at the bottom
Here is another great tip but must be applied where applicable only. Put the stylesheets at the top of the page but put the scripts at the bottom. The script block away parallel processing of the page. So to speed things up out the style sheets must be located the top and scripts at the bottom.
15. Online Analytic tools
There are a number of online analytical tools that will give you a complete and detailed view of the full functioning of the website. It will tell you which pages are getting the more view and which are not getting any views at all. Google Analytics is one such application and it is good to give the full comprehensive look to the website.
read more Google Cloud Storage Introducing Pricing
So these were are top 15 tips for managing server. If you are managing server properly, there will be no danger of your website getting down. Try some of these great tips and share the results by commenting below.