Web Front-end optimization best practices-Server

Source: Internet
Author: User
By fenng|It can be reproduced. During reprinting, it must be indicated by a hyperlink.ArticleSource and author information and copyright notice
Web: http://www.dbanotes.net/web/best_practices_for_speeding_up_your_web_site_server.html

Web Front-end optimization best practices Part 2 is for server. Currently, there are a total of 6 practice rules. [Note: this is the most technical note. For the original content, visit: predictional performance: Best practices for speeding up your web site]

1. Use "> CDN(Use a content delivery network)

China "> the popularity of CDN is not enough. But we haveUnique problems between China Telecom and China NetcomIf you want to optimize it, you can basically get the "> CDN or similar effect (pretend to be so ). [Tin said "> CDN is used quite a lot in China. Let's look at it."> the CDN vendor's market will know that it hasn't entered the usual market]

2. Add an expires or cache-control header)

Each browser has a specific solution. For Apache example, [Note: the example below is not detailed enough, and some adjustments need to be added to the specific environment ]:

 
Expiresactive onexpiresbytype image/GIF "modification plus 1 weeks"

After the mod_expire module is enabled for Lighttpd:

$ HTTP ["url"] = ~ "/. (JPG | GIF | PNG) $" {expire. url = ("" => "Access 1 years ")}

Nginx example reference:

 
Location ~ */. (JPG | GIF | PNG) $ {If (-F $ request_filename) {expires Max; break ;}}

 

3. Compressed Content (gzip components)

 

For the vast majority of sites, this is a necessary step to effectively reduce the network traffic pressure. Some people may worry about the impact of "> CPU compression on"> CPU, so be sure to make sure it is okay. Nginx example:

 
Gzip on; gzip_types text/plain text/HTML text/css ext/JavaScript;

For more information, see:

      How does IIS enable gzip compression?

 

4. Set etags (configure etags)

Etag may be ignored by most website maintainers. Before this series of optimization rules emerged, most websites on the Internet may ignore this problem. Of course, etag does not have a significant impact on the performance of most sites. Unless it is for "> RSS websites. [A friend criticized and said, "> IE does not support etag. Specifically, ie supports etag, but "> IIS should pay attention to the etag bug .]

Supplement: I mean, "many websites open etag without looking at it, but they do not know how to use it and consume resources. It does not mean that etag is not good, and the rational use of etag can definitely achieve good profits.

5. Refresh the buffer (flush the buffer early) as soon as possible)

After thinking about this article for a long time, it seems thatAsynchronous. Can it better improve user experience?

6. For "> AjaxRequest to use the get method (use get for "> AjaxRequests)

XMLHttpRequest Post takes two steps, while get takes only one step. However, you must note that on "> IE, get can process up to"> the URL length is 2 K.

Previous Article:

    • Content of best web browser optimization practices

 

Next, analyze the cookie.

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.