Accelerate your Ajax application

Source: Internet
Author: User

Source: Ajax data station

Digg.com, which is known to surpass Slashdot, is a typical Ajax application. Its homepage uses the prototype framework and scriptaculous extension. A good idea is to collect statistics on the total number of bytes of JavaScript and CSS files downloaded when loading the digg.com homepage. It is found that HTML + JS + CSS has more than 250 kb, so Digg is proposed: javascript overload? . Zimbra provides some Optimization Methods for this problem: Ajax and CSS optimization. The main points are as follows:

Integrate multiple JS or CSS files into one file to reduce the number of HTTP connections. Use a jsmin-like tool to remove comments, blank spaces, and extra blank lines to reduce the amount of data transmitted over the network, after the Web server application gzip compression zimbra is optimized using the above method, the test shows that the bandwidth is reduced by more than 50%.

In our current and future Ajax development, we will certainly encounter performance problems similar to digg.com. Zimbra solutions are available for reference. I think HTTP compression is the most important part of Ajax optimization. We can apply the default mechanism provided by web server, such as the compression option provided by tomcat5.x in connector configuration. A typical connector configuration is as follows:

<Connector

Port = "8080" maxhttpheadersize = "8192" maxthreads = "150" minsparethreads = "25"

Maxsparethreads = "75" enablelookups = "false" redirectport = "8443"

Acceptcount = "100" connectiontimeout = "20000" disableuploadtimeout = "true"

Compression = "on"

Compressablemimetype = "text/html, text/XML, text/plain, text/JavaScript, text/CSS"

/>

The preceding configuration uses the compression attribute to activate compression, and then uses the compressablemimetype attribute to set the MIME type for application compression. The most famous Apache server also provides mod_deflate and other modules to provide similar compression configurations.

In addition, the compression function can be provided by calling the API programming provided by Web server. For example, Java is also widely used to provide a gzipfilter application for servlet containers.

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.