|
|
A Practical Guide To Decrease Web Page Load TimeWhy is it important for your pages to load fast you might ask. The answer is easy; if your pages load slowly you will loose sales. From a consumer perspective you have a fraction of a second to show activity. Your page doesn’t have to load completely but they certainly need to see some activity right away. Why is it important for your pages to load fast you might ask. The answer is easy; if your pages load slowly you will loose sales. From a consumer perspective you have a fraction of a second to show activity. Your page doesn’t have to load completely but they certainly need to see some activity right away. Consumers are impatient and have been trained by the major sites that pages start displaying immediately. If you don’t have fast loading pages, most consumers will go to the next site. It’s not just consumers that value speed, major search engines have stated that it is important for pages to load fast if you want them indexed. The faster page loads, the more pages you will get indexed. Some search engines have come out and stated that they will even downgrade your paid search marketing if your pages load slowly. What can you do to increase page load speed? Below are the techniques I used to successfully decrease the time it takes to load web pages.
Next you want to check SQL memory usage. By right clicking the server in Enterprise Manager and selecting properties you can view the Memory tab. Use this tab to give as much memory as you can afford to SQL. The more memory you give the SQL the more data it can cache, thus returning results faster. Does your server have more than 2GB memory? If so use this guide to configure your server to see all that available memory http://support.microsoft.com/kb/283037 then this guide http://support.microsoft.com/kb/274750 to configure SQL to see more available memory. To make sure SQL is using available memory don’t use task manager as it may report incorrectly. Instead use PerfMon Process Object, Working Set Counter, sqlservr Instance. Give your server time to build up its cache after restarting before checking this counter. You want to make sure your CPU can keep up. Caution this counter can be misleading. Although you may be recording sustained high CPU utilization this may not mean you need a faster CPU, the lack of adequate disk speed and memory may be artificially increasing CPU utilization. If CPU utilization is averaging over 80% for an extended period of time and you have already ruled out memory and disk as an issue you may need to upgrade your CPU(s). Use PerfMon to track CPU utilization using the Processor Object, % Processor Time Counter, and applicable instance if you have more than one CPU. If your server has more than one CPU and you can afford to let SQL use more than one, right click on the server in Enterprise Manager, select Properties, and then the Processor tab. This will allow you to select multiple or all CPUs for SQL utilization. Bandwidth is a little more obvious but still needs to be mentioned. If you have sustained high bandwidth utilization this will become a bottleneck causing slowdowns. Bandwidth utilization can be a bit harder to check. If you are using a hosting company they should be able to tell you (typically with some type of real time monitor that you can log into) what you are averaging with bandwidth as well as spikes in bandwidth. You will want to make sure you have plenty of available bandwidth from your hosting company especially during the busy part of your day. If your hosting company cannot provide these reports you can utilize a hardware or software sniffer to determine bandwidth usage. The key is to make sure your connection can handle much more than you typically use. If you are averaging 80% utilization you should consider upgrading your connection. Now that you have checked the major hardware bottlenecks put your DBA hat on and make sure your indexes are up to date. If you’re not an experienced DBA that knows the best way to manage your indexes, use SQL Profiler (Tools, SQL Profiler from Enterprise Manager). Create a new trace and select the SQLProfilerTuning template. Make sure the time you record is long enough to collect data on regular activity. Additionally if you can generate additional traffic (especially traffic that causes slowdowns) you will want to do as much of this as possible while collecting data. Once you have finished collecting data, click Tools, Index Tuning Wizard. Use the profile you just created and make sure to select the database in question. When finished running apply any changes suggested. You may need to run this multiple times until there are not recommended changes. Additionally as you make changes to your database such as adding new fields you will want to run this entire process again to find and apply new recommendations. I like to run this process on the regular basis just make sure everything is running smooth. As a side note, make sure every table in your database has a primary key. Once you have optimized your indexes run SQL Profiler again to check what kind of activity you are having on your SQL server. Do you have long running queries that could be changed to run more efficiently? Do you have queries that are being run over and over that you could cache inside your website application? As you make upgrades and additions to your web pages you many times will add extra queries to your database. Go through your pages and find out if you can combine queries to return information with one query instead of two. If you have to make multiple queries, try to make one connection to the database, and then use that same connection for all the queries. This way you are not making repetitive connections to the database one after the other. Making a database connection can be time consuming and resource intensive. The way you partition your database across drives on your SQL server can help if you are suffering from high disk utilization. The following configuration has worked well for me note that each partition is on a separate physical drive: Using RAID 5 on the D drive allows very fast reads because multiple drives can respond to the request. Additionally requests do not have to wait for writes to the Log Files or Temp database. Because the D drive is for read data, SQL can more effectively use memory to cache frequent requests. There are a lot of write requests to the SQL log files and temp database so giving them they’re own separate drive reduces contention. It goes without saying that using drives with higher RPM, more throughput, and a larger cache will assist your SQL server to run faster. Web Server Optimization Database Backups Load Balancing/Multiple Servers If you currently run a single server, determine what resources are lacking, probably disk or memory, maybe CPU and what is using these resources. Typically when moving from a single server to multiple servers you will put in a new server and only put your database on that new server. Next I’ll show you a configuration with three servers that has worked out exceedingly well for me: Another popular method is to setup multiple SQL servers (assuming this is the main bottleneck) with separate data. For instance if you keep your images in SQL, you may want to move them to they’re own server then make a connection to one server for some of your data and to the other server for retrieving images. Web Page Design
Image Optimization Caching You can enable browser caching by using the HTML Expires heading for any pages that can cache. This type of caching tells the visitors browser that if it returns to this exact page it’s doesn’t need to go back to the web server and retrieve the page again. This will help when people are browsing your site and come back to the same page multiple times. If the page is more static, like an article page for instance, you may be able to set it to cache for 30 days. This will allow the same person to go to that page different days without having to hit your server. The downfall of this caching is that it only helps if people visit your page more than once within the caching time. Another type of caching is server side page caching. This allows you to cache a page on the server instead of the browser, therefore when defining the caching time, anyone that requests the page inside of the cache time will receive the cached page. Server side caching will allow your web server to cache the page in memory (given there are enough memory resources available) which means it does not have to go to the disk to retrieve the page or query the database. Let’s say for example the front page of your website has a tree view menu that makes multiple database queries to build the page. If this page is requested many times an hour it will generate a lot of resource strain on your servers. If you set this page to cache for 15 min. you now only create that resource strain once every 15 min. allowing your server to respond better to other requests and your page will display much faster. Of all the things you can do to make your site faster, this may have the biggest impact. Similar to server side page caching is partial page caching. This is a little more complicated but allows you to cache parts of your page. Let's use the example above again but this time the criteria mandates that we can’t cache everything in the page. In this case we may want to just cache the menu as the menu is relatively static and is a large resource drain on the servers and slows down page delivery. Separate Domains Progressive Rendering
Compression Website Errors There are certainly many additional things you can do that don’t fit the scope of this article. This is meant as a practical guide for the small to mid size Internet retailer. I hope you have found this informative and at lease consider each one of these techniques before exploring more in-depth or expensive solutions. Here is a free Web Page Load Time Tracker http://loadtimetracker.internetretailerblog.com that you can use to monitor the speed at which your pages load over time. This resource is unique in that it uses an actual web browser to render the page including downloading and displaying CSS, Images Article Tags: Page Load Time, Page Load Time , Practical Guide, Page Load, Load Time, Pages Load, Make Sure, Sustained High, Hosting Company, Many Times, Load Time , Master Server, Slave Servers, Java Script, Server Side, Grid View Source: Free Articles from ArticlesFactory.com
ABOUT THE AUTHOREdgar E. Kneel is the lead programmer and architect at a popular Internet retailer. His blog is http://www.internetretailerblog.com
|
||||||||||||||||||||||||||||||||||||||||||
Partners
|