Tips for improving your blog's performance

Source: Internet
Author: User
Keywords Java can improve HTTP merge

For the server hirer, want to improve their website performance in the hardware environment, http://www.aliyun.com/zixun/aggregation/16327.html "> Network Environment", the influence of objective factors may be more difficult. Therefore, only to return to the second, in the process of hard work. For independent blog owners, the use of the blog is generally a more mature version of the program, these programs in order to apply the extensive often in the code left a lot of room for improvement, so we can do some kung fu.

In the previous article, I also series of articles to describe how to improve the performance of the best site experience, but also provides a Yahoo! launched tools YSlow to improve the performance of the site, on the basis of reference to these principles, I for Pjblog blog program (other independent blog programs and sites can also be used as a reference) For example, improve the method:

Merge JavaScript files. In both Pjblog and other blogging programs, you use a large number of external JavaScript files, you know, to introduce an external file to send an HTTP request, and in all the factors affecting the speed of the page response, the HTTP request is the most critical one, So it's a good idea to combine all the Javascrip files into a javascript.js file. However, you should be aware that different JavaScript files use different variables and function names, and you want to make sure that they work properly after merging. In some cases, you can also have two separate JavaScript files;

Reduce your JavaScript files. Merging JavaScript files is designed to reduce the number of HTTP requests, but it doesn't make any difference in volume, so you'll need to streamline the things that are not used in JavaScript files, such as annotations, line-wrapping, whitespace, and so on, which probably narrows your program down to 20%~30% space. You can compress files using ESC 1.14, which has a compression rate of more than 60%, which is helpful for reducing response size and improving response speed.

Merge CSS files with lean CSS files. As with JavaScript files, merging all CSS files into a single style.css, CSS is better than JavaScript to deal with the fact that it is less likely to conflict, even if conflict is not a big problem. Streamlining removes the extra styled formatting and puts all the CSS rules on one line. This program, called Minify, not only compresses CSS but also compresses JavaScript and PHP programs. But the caveat here is that if you are merging and streamlining files, be sure to keep the original files for later use when the program changes.

Use CSS sprites. The so-called CSS sprites is all the CSS used to do background images of the picture files are placed in a file. In the skin of Pjblog and other blogging programs, many of the authors do not use CSS sprites, which causes an HTTP request to be sent once for every background rule, and if you use CSS sprites you need only one HTTP request to save unnecessary expenses.

Use caching. For static content (such as Flash, JavaScript, CSS, Image) by adding expires headers or Cache-control to the client, the user will not be able to download the content on the next visit, This reduces the number of HTTP requests and reduces the size of the downloaded file. Setting a file header in IIS is simple, right-click on the file or folder you want to set--attribute--http header, and then check "Enable file expiration", set the expiration time, can be a year or ten years, can also specify a future time, such as 2010 years. But you set the HTTP header, and if you want to make changes to the file you need to name the modified file again.

The

enables gzip compression. Gzip compression for JavaScript, CSS and other content a compression technology, it can greatly reduce the volume of files to improve transmission rate, streamlined JavaScript and CSS just remove unnecessary content, and gzip compression is the file on the server side of the package, the client unpack the process. Both Apache and IIS6.0 have gzip enabled, and modern browsers support gzip technology (even if it is not supported, it tells the server not to pack), so it's safe to use. In IIS6.0 you need a simple configuration before you can use the GZIP technology, and in Apache 1.3 you will enable Mod_zip to use Moflate in Apache 2.x. Gzip can save 70% of the transmission space, the Internet currently has 90% browser data support gzip transmission.

Related Article

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.