Improvement of Web server in Web site performance

Source: Internet
Author: User
Tags header include website performance akamai technologies

In the first section of this series, we talked about the 10 principles that are relevant to the "content" of the Web site's performance. In addition to the content improvements in the Web site, there are also areas on the Web server that need attention and improvement, including:

    1. Using Content distribution networks
    2. Specify expires or Cache-control for file headers
    3. Gzip Compressed file contents
    4. Configure ETag
    5. Refresh output buffers as early as possible
    6. Using get to complete an AJAX request

11. Use Content distribution network

The proximity of the user to your Web server can affect the length of response time. Spread your site content across multiple servers in different geographic locations to speed up downloads. But what should we do first?

The first step in arranging your site's content by geography is not to try to rearrange your site so that they run properly at the Distributor. Depending on the requirements of your application, you can change the structure of your Web site, which may include more complex tasks, such as synchronizing session status between servers and merging database updates. These architectural steps may be unavoidable in order to shorten the distance between users and content servers.

Keep in mind that 80% to 90% of response times in end-user response times are used to download page content such as images, stylesheets, scripts, Flash, and so on. This is the website performance Golden rule. It's much better to distribute static content first than to redesign your application architecture as a more difficult task. This not only shortens response time, but it is easier to implement for content distribution networks.

Content distribution Networks (Delivery NETWORK,CDN) are made up of a series of Web servers dispersed across geographically diverse locations, which increase the speed at which Web content is delivered. The server that is used to transfer content to the user is primarily specified based on how close the user is to the network. For example, a server with the least number of network hops (network hops) and the fastest response will be selected. Click here to view the content of the Web production tutorial channel

Some large web companies have their own CDN, but the cost of using CDN services like Akamai Technologies, Mirror image Internet, or limelight Networks is very high. For start-ups and personal sites, it may not be possible to use CDN's cost budget, but as the target user base expands and becomes more globalized, CDN is required to achieve fast response. In the case of Yahoo, the static content of the website program they transferred to the CDN saved more than 20% of the end-user response time. Using CDN is a way to dramatically improve the speed of Web site access by simply modifying the code to achieve a relatively simple change.

12. Specify expires or Cache-control for file headers

The code includes two elements:

    • For static content:
      Set file header expiration expires value is "Never expire" (never expires)
    • For dynamic content:
      Use the appropriate Cache-control file headers to help the browser make conditional requests

Web page content design is now more and more rich, which means that the page to include more scripts, style sheets, pictures and flash. The first time you visit a user on your page means you make multiple HTTP requests, but by using the expires file header you can make this content cacheable. It avoids unnecessary HTTP requests in the next page access. The expires file header is often used for image files, but it should be used for all content, including scripts, stylesheets, and Flash.

browsers (and proxies) use caching to reduce the size and number of HTTP requests to speed up page access. The Web server uses the expires file header in the HTTP response to tell the client how long the content needs to be cached. The following example is a long expires file header that tells the browser that the response will not expire until April 15, 2010.

Expires:thu, APR 20:00:00 GMT
If you are using the Apache server, you can use ExpiresDefault to set the expiration time of the relative current date. The following example uses ExpiresDefault to set the file headers that expire 10 years after the request time:
ExpiresDefault "Access plus years"
Remember that if you use the Expires file header, you must change the file name of the content when the content of the page changes. According to Yahoo!, we often use this procedure: Add a version number to the file name of the content, such as Yahoo_2.0.6.js.

Using the Expires file header will only work if the user has already visited your site. This is not valid for reducing the number of HTTP requests when a user first visits your site, because the browser's cache is empty. So the way you can improve your site's performance depends on how often you click on the page when they "cache" ("cache" already contains all the content in the page). Yahoo! has established a set of measurement methods, and we find that all 75~85% in page views are "pre cached". By using the Expires file header, the amount of content cached in the browser is increased and can be reused in the next request by the user, which does not even require a byte request to be sent through the user.



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.