Loading speed Upgrade: Make website construction program lean to detail

Source: Internet
Author: User
Keywords Programming

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

This winter, the most impressive than two sites, one is 12306 train ticket purchase site, one is the official website of Millet mobile phone. A common feature of two sites is that concurrent visits are slow to endure. In fact, more than the two sites, in the face of tens of thousands of concurrent visits, at least more than 90% of the site will be dead. Even when the number of visits is usually not much, many web site opening speed has been unbearable. The reasons that affect the speed of the site loading, such as server configuration, room bandwidth quality and interconnection lines, etc., but I feel that the Web site programming and resource integration also greatly affect the speed of the Web site, but many people do not pay enough attention to the comparison.

Consolidated Web site Resources

Why is the railway station ticket reservation site so not in high concurrency? Some good people on this site in-depth analysis, the general conclusion is that the site in the submission of orders to the server to send too many requests, plus the original instantaneous access traffic is very large, so that the access request blocked. In fact, this problem exists on many websites, especially small and medium-sized companies ' corporate websites. Know the problem, solve it is handy, the answer is to reduce the frequency of the server to send requests, and the combination of resources is the most effective way. This allows the same call file to be loaded at a time that is appropriately extended, but the number of uplink downloads is reduced and the code is more efficient to run.

General Web sites need to be loaded externally to a roughly three kinds of resources, respectively, are CSS style sheets, JS script program and picture footage. This three can be properly merged to minimize the number of requests to the site. CSS as long as the purpose is to control the style of the site, if all the CSS merged into a file, be sure to place it in the <head> tab, the purpose is to let the site first load CSS. JS and other scripting programs, is to achieve some special effects of the Web page written, call the location can be appropriate, but need to understand that JS is different from the CSS is not all of the JS can be merged together, the reference location is also critical, otherwise it may cause some of the site function failure. Picture material merge more see in the background of the website, call the picture through two-dimensional coordinates, but need to notice even so, the picture size after merging should control within 2M, otherwise it will bring bad user experience because of too long loading time.

Second, compressed page elements

If the site resources are already large, through the merger can reduce the time, but still can not fundamentally solve the problem. Because the main reason for merging Web resources is to reduce the number of requests from the client to the server, the site resource size is unchanged. Therefore, the necessary compression of the page elements, is to enhance the speed of the Web site access to another shortcut. Compress page elements The first method is to rewrite the site code, to know that the use of Div layout Web site program, than the table layout can reduce a lot of code. The future when HTML5 technology popularization, the site code volume will be further compressed, to avoid code redundancy is a great way to reduce the volume of the site, especially the deletion of some unnecessary fee code.

Now a lot of Web site loading speed is slow, and the site is used in the picture material has a direct relationship. If there is no special requirements, but on the display site image display resolution control in 72DPI can be, even if the picture shows a little less quality, the total than half a day can not load the user feel better. Therefore, if possible, please control the size of the site image below 200Kb, on the site as little as possible with a number of high-resolution high-quality picture material. Through the server to open gzip compression, is also a good way to reduce the volume of Web pages, the author has hands-on experience, 50K about the size of the Web page, open gzip compression can be controlled in about 10K. The compression rate of Web pages is over 60%, so it is not surprising that the website is running fast.

Third, adjust the code location

Can the code location also affect the load speed of the site? The answer is yes, we give a simple example, now many websites have statistical procedures. Most of them through the call to the external JS implementation, is generally a statistical program placed at the bottom of the site, the purpose is to avoid the station outside the JS loading speed too slow, affecting the entire site's user experience. This is obvious, if you put some large script program on the head of the Web page, it is bound to slow down the entire site loading speed. There are two principles that need to be adhered to to adjust the site code location, the first is that the outside of the site calls the code as much as possible to place behind the load, because the external code is not controllable; the second is, mention the larger script program placed behind the program loading, especially some JS program, without affecting the site effect, Try to load execution after other code as much as possible.

There is a problem that is not related to the location of the code, but it is also very easy to be overlooked by many programs, is the Web page rendering problems. For example, we have a <style= in the CSS code "Border:none" > and <style= "border:0", there is no difference in the visual presentation of the page, but for the browser to explain the rendering is different. <style= "Border:none" > represents no border, no border rendering, but <style= "border:0" > Description has a border, only the width of the border is 0, in fact, the browser in the interpretation of the Code, will be done once and not rendered. Similar to the size of the site image control, many programmers think that if the size of the picture is just the same as the standard, there is no need to define the height and width of the picture, this will make the code concise enough, in fact, this understanding is wrong, no definition means that the browser to identify and then render the display, And this process takes time.

As a professional website construction and network Marketing Organization, pilotage Technology (http://www.joyweb.net.cn) has always believed that the site's user experience and marketing effect and the speed of the site closely related, especially in the hearts of the impetuous now. Therefore, in the increasingly popular network marketing today, most people pay more attention to the site to the user feel. There is a truth to be reckoned that both China Telecom and the Chinese Unicom and other broadband operators will now bring a quick rate to the agenda. This means that the average Internet users will be more and more fast, web site speed or slow impact on the network marketing effect will be more and more obvious. Sometimes, even if someone else's website is opened in half a second, it may cause you to lose a marketing opportunity. So, if possible, try to increase the speed of the site, even if it is 100 milliseconds or even shorter moments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.