Experience on improving Apache speed by 10 times

Source: Internet
Author: User

The module is mod_gzip. It compresses apache pages by using the same compression algorithm as gzip. If possible, it can compress the pages into one of ten copies of the original size. If a 10 k page is uploaded to 1 K, this is 10 times faster. Of course, the general web page can only be 3-6 times. That's pretty good. Right. Even a large website like google uses this technology. Are you not keeping up with me?
  
I will tell you how to install this kind of things in three steps: 1. Download, 2. modify configurations, 3. Test.
  
1. Download

Download mod_gzip.c from the http://www.remotecommunications.com/apache/mod_gzip and install its patch.
  
2. install and configure

Put mod_gzip in your apache source code directory, and create a mod_gzip directory. If you need a patch (for version 1.3.17.la), run the following command:
Patch mod_gizp.c
Select dynamic DSO or static compilation to apache in configuration as needed. In README, how to handle it is clearly stated, such as-add-module = mod_gzip.c, make, make install, and so on. I will not talk about it here.
  
Add the following configuration to the end of httpd. conf.
  
# MOD_GZIP configuration
Mod_gzip_on Yes
Mod_gzip_minimum_file_size 1002
Mod_gzip_maximum_file_size 0
Mod_gzip_maximum_inmem_size 60000
Mod_gzip_item_include mime "application/x-httpd-php"
Mod_gzip_item_include mime text /*
Mod_gzip_item_include mime "httpd/unix-directory"
Mod_gzip_dechunk Yes
Mod_gzip_temp_dir "/tmp"
Mod_gzip_keep_workfiles No
Mod_gzip_item_include file "\. php3 $"
Mod_gzip_item_include file "\. txt $"
Mod_gzip_item_include file "\. html $"
Mod_gzip_item_exclude file "\. css $"
Mod_gzip_item_exclude file "\. js $"
  
Run
... /Bin/apachectl configtest Ensure that the configuration is modified correctly.
Use the apachectl restart command to restart the service.
  
3. Modify and Test

Before the announcement, we should test the habit of being a good programmer. To minimize the impact on user browsing, we can use the new apache driver on port 8080 or use commands to control the directory where mod_gzip works, instead of using mod_gzip all at once.
The usage is as follows:
  
MOD_GZIP configuration
  
You can use IE4 or netscape to perform a comprehensive test. If there is no problem, you can make your users happy to find that the 'xx website is so fast now. '
  
Mod_gzip is amazing. A large k HTML document can be uploaded to the user end as long as 12 K. The more you use this technology, the more high your users will be impressed with your website. However, there must be some loss. Because decompression is performed on the client, the effect has something to do with the user's browser. I tested that MSIE4, 5, 5.5, netscape 4.5, and 6 run well. However, java, jpg, and gif cannot be compressed.

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.