If your site is too slow to open and you don't know how to fix it, then this article is a must-see. Hands-on teaching you how to troubleshoot the cause of the slow opening of the website, as well as optimization methods.
To troubleshoot why a website is slow to open:
1 Site Server speed or leased space server speed
The server space speed is the hardware foundation that the website opens quickly, also is the precondition. Otherwise, even if your site page design is very "slim", the website opening speed will be discounted. Solution: To find your space quotient to solve or change space quotient.
How to detect the speed of the server?
method One : The ping command looks at the time and packet drops that are connected to the server.
1> Click the Start key and select Run, then enter CMD in the Run dialog box
Note: Some may be input command, or there may be windows without a DOS system.
2> type ping and the URL you want to test (for example, Ping www.viila.net-t). Then enter and get back the time you accessed the server.
In general, the "PING" command will go on automatically until you make it stop, such as tapping "Ctrl +c". If you are familiar with the ability to use ping in Telnet, and you have a Telnet account on a different network, you can ping the other hosts (IP addresses or domain names) on a different network basis, and you can compare the response times of those hosts that are accessed at different access points and get "Packet loss rate", average response time and other test results.
Time: Shows when the packet returned after it reached the remote host. The calculation is positioned in milliseconds. The smaller the number, the faster it becomes.
Lost: Packet loss situation.
TTL: Time-to-live specifies the number of network segments that a packet is allowed to pass before it is dropped by the router.
A good speed of the computer room, the first packet loss rate can not exceed 1%, preferably 1000 without a packet loss, this is the most ideal, but this is not an absolute value, as long as less than 1% of all belong to a good routing situation.
Second, the ping value is small, the same city of the telecommunications ADSL ping average must not exceed 20, generally in 10, the cross-province ADSL ping average value should be in the 20-40 belong to normal .
The 3rd is the ping value is uniform, if the minimum ping value is only 4, but from now on dozens of, the maximum 79 of the appearance, this is the performance of the route is not stable, the same telecommunications adsl, although the smallest also has 8, but the largest also only 9, it shows that the route is stable.
method Two : View the speed at which other sites on the same server are open.
same IP address site query URL: http://indexed.linkhelper.cn/sameip.asp
The query tool above allows you to see the number of sites and URLs from the same server. You can see if other websites are open or slow.
2 Telecom and Unicom exchange visits bottleneck problem.
If the space is opened quickly and slowly, and sometimes not open, that is the reason for the instability of space. To find your space quotient to solve or change the space quotient, if in some places open fast, some places open slowly, that should be the problem of network lines. Telecom Line user access to the website of the Unicom server, Unicom line users to access the website placed on the telecommunications server, relatively speaking, the speed is certainly slower.
WORKAROUND: If you buy space, it is recommended to buy two-line space or multi-line space. This is not a new concept, most of the virtual host has two or more lines of space, the price is higher, but from the user experience point of view is value for money.
3 from the site itself to find the problem , the site's problems include the website design, Web page structure, Web content three parts.
Website Design :
1> Web page If there is a slideshow effect of the code, you need to review, whether seriously slow down the site opening speed.
2> If you exclude all aspects of the reasons, you can find the design of the relevant professionals, to see whether the program structure is reasonable.
Web Design Structure :
1> if it is a table-layout web site, see if it is nested too many times, or a large table and then divided into multiple tables such as page layouts. Solution: The proposed div layout, with CSS, so not only open fast, but also conducive to modification.
2> If the site has statistical code, online customer service or other JS code to see if it is placed in the last page of the code. Workaround: It is best to put the Web code at the end of the page, and then execute the code when the site code is loaded.
3> may have the wrong code
One case is to see if the page code has a picture or file path code that does not exist. (as shown in firebug see 20.jpg This image, the red display indicates that the actual does not exist, code to call it) because the picture itself does not exist in space, but in the execution of the code, when the execution of this line, but to continue to load the image, in a subtle way will affect the speed of the site.
Another situation is from other sites copied special effects JavaScript code, may be reproduced incomplete, there are many page errors, causing the website to open slowly. Workaround: Fix code errors on the site.
4> minimize the use of JavaScript effects.
such as: mouse effects, column effects, status bar effects, and so on, the principle of these special effects are first downloaded from the server to your local machine, and then run on the local machine generated, if you watch your website's user machine configuration low, to run a period of time to complete.
Web content :
1> See whether there are many large-sized pictures in the Web page, if you want to express the picture effect, you can cut the big picture into several small pictures. Picture to lose weight processing, can make the number of bytes smaller, or many of the pictures will occupy a lot of space and make the website open slowly. Can use Photoshop, fireworks and other mapping software to reduce the size of the picture, so that the quality of the picture slightly lower, in the picture quality and image size between the search for an optimal ratio.
2> See if there are large-size flash files in the Web page, excluding the expression effect, try to use less large flash.
3> some friends like to add music to the Web page, users open the site, there is background music playback, such things try not to do.
The content of other websites is too much referenced in the 4> content. If you refer to a picture or other content from another website, if that website is slow, or the page of that site is no longer there, the speed of opening will be slower. Solution: Such a problem is common in the case of links in the exchange of images linked to the link to the other sites of the logo image, it is recommended that the other's logo images uploaded to their own site space, and then add the link. The second situation is that many friends like to use IFRAME nested other sites on the search, check IP and other small function modules, it is recommended to use less this way.
Viewing images, code, and more in the website can be viewed using the Firefox plugin tool Firebug tool.
Ways to optimize loading speed:
First, optimize the picture
There are few pages on which there are no pictures. If you have experienced the age of 56K cats, you will not be very fond of sites with lots of pictures. Because it takes a lot of time to load a Web page like that.
Even now, the network bandwidth has a lot of improvement, 56K cat gradually fade out, optimize the picture to speed up the page is still necessary.
Picture optimization includes reducing the number of pictures, reducing image quality, and using the appropriate format.
1, reduce the number of pictures: Remove unnecessary pictures.
2, reduce the image quality: if it is not necessary to try to reduce the quality of the image, especially the JPG format, reduce the quality of 5% is not very large, but the size of the text changes are relatively large.
3. Common sense uses script files instead of effects:
For example, some web2.0 style, if the use of PS production, each image will basically increase the size of%5-%25 cost.
Instead, use JavaScript code to achieve the effect, adding only a few bytes.
Second, the choice of image format
There are three types of image formats that are commonly used on Web pages, JPG, PNG, GIF. Specific technical indicators in three formats are not what this article explores, we only need to know when to use what format to reduce the load time of the page.
1, JPG: Generally used for the display of scenery, characters, art photo photographic works. Sometimes it's also used on computer screenshots.
2, GIF: Provide less color, can be used in some of the color requirements are not high, such as website logo, buttons, emoticons and so on. Of course, an important application of GIF is animated pictures.
3, png:png format can provide a transparent background, is a special for the web display and invented the image format. Typically used on Web pages that require a transparent background display or a higher quality image.
Third, optimize the CSS
CSS overlay style sheets make Web pages more efficient to load, and the browsing experience is improved. With CSS, table layouts can be retired in a way.
But sometimes we use some wordy statements when we write CSS, like this:
Copy Content to Clipboard
Code:
margin-top:10px;
margin-right:20px;
margin-bottom:10px;
margin-left:20px;
You can simplify it to:
margin:10px 20px 10px 20px;
Or this sentence:
<p class= "Decorated" >a paragraph ofdecorated text</p>
<p class= "Decorated" >Secondparagraph</p>
<p class= "Decorated" >Thirdparagraph</p>
<p class= "Decorated" >Forthparagraph</p>
You can use DIV to include:
<div class= "Decorated" >
<p>a paragraph of decoratedtext</p>
<p>Secondparagraph</p>
<p>Thirdparagraph</p>
<p>Forthparagraph</p>
</div>
Four, after the Web site and slash
Some URLs, like http://www.viila.net/512. When the server receives such an address request, it takes time to determine the file type of the address. If 220 is a directory, you might want to add a slash after the URL to make it http://www.viila.net/512/, so the server can see at a glance to access the index or default file under the directory, saving load time.
V. marking height and width
This is important, but many people tend to ignore it for laziness or other reasons. When you add pictures or tables to a Web page, you should specify their height and width, which is the height and wide parameters. If the browser does not find these two parameters, it needs to download the picture while calculating the size, if the picture is many, the browser needs to constantly adjust the page. This affects not only speed, but also the browsing experience.
Here is a more friendly picture code:
Copy Content to Clipboard
Code:
When the browser knows the height and width parameters, even if the picture is temporarily unable to display, the page will free up the picture, and then continue to load the later content. So the loading time is fast and the browsing experience is better.
Vi. Reducing HTTP requests
When the viewer opens a webpage, the browser makes a lot of object requests (images, scripts, etc.), depending on the network latency situation, each object loading will be delayed. This can take a lot of time if there are many objects on the page.
Therefore, you need to offload the HTTP request. How to lighten the burden?
1, remove some unnecessary objects.
2, the adjacent two pictures to synthesize a picture.
3. Merging CSS Files
Take a look at the following code, which requires three CSS files to be loaded:
<link rel= "stylesheet" type= "Text/css" href= "/body.css"/>
<link rel= "stylesheet" type= "Text/css" href= "/side.css"/>
<link rel= "stylesheet" type= "Text/css" href= "/footer.css"/>
We can synthesize it into one:
<link rel= "stylesheet" type= "Text/css" href= "/style.css"/>
Thus reducing the HTTP request.
Vii. Other tips
1. Remove unnecessary add-ons.
2, if you embed the other Web site widget, if there is a choice, be sure to choose a fast speed.
3, try to use a picture instead of Flash, which is also good for SEO.
4, some content can be statically static, to reduce the burden on the server.
5. Put the statistic code at the end of the page (or use lazy loading).
Causes of slow opening of Web sites, troubleshooting methods and Optimization methods