Liferay Front-End Performance tuning (3) Gzip Filter

Source: Internet
Author: User
Tags comparison requires resource

For most HTTP requests, if we can get them to provide these resources in the form of compressed files, they can also be enormously efficient. All we need to do is turn on gzip, and then we can reduce the amount of network time it takes to download these resources.

For comparison, let's take a screenshot, which is not enabling gzip:

As you can see, before enabling gzip, downloading Ext-all-debug.js requires a file as large as 2.8MB and takes 1.53 seconds.

Then we configure Gzip Filter, which requires 2 steps:

(1) The function of enabling Gzipfilter in the $liferay_home/portal-ext.properties file is as follows:

(2) in $TOMCAT _home/conf/server.xml, because the page we are testing is deployed on port 8080, we find the 8080 Port connector (Connector) and then enable gzip, specifically by adding the following parameters:

Compression= "On"

Compressionminsize= "2048"

Nocompressionusera gents= "Gozilla,traviata"

Compressablemimetype= "Text/html,text/xml,text/java script,text/css,text/plain,image/gif,image/png,image/jpg"/ >

Here we can clearly see that we have enabled compression, and then we have defined the type of resource that needs to be compressed, with the Compressablemimetype attribute, so all the front-end resources we can think of here are in this list of types.

Finally, we open the Firebug to test again, and as a result of the comparison, the performance is greatly improved:

From this we can see that the current Resource header content-encoding is set to gzip, so this means that our gzip functionality has been properly turned on, After we found that the size of the ext-all-debug.js from 2.8MB to only 550KB, and the network transmission time from 1.53 seconds reduced to 906 milliseconds, almost reduced the download time of 40%, the other resources are corresponding download time has been greatly reduced. The visible effect is obvious.

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.