App on the line, found that the application of comparative fee flow, so consider the application optimization, reduce access to traffic. First, the most cost of the flow of the section is the acquisition of news listings, because our news list with a variety of states and permissions, if the news after the exit, its status and permissions may be changed. So there is no caching of Web page data locally, each time it is new. First look at the print log, find the returned data, a large number of images are the Web site, we use the Seven Cow image server, all the prefixes are the same, so first the database to save the picture from the Web site to modify the name of the picture, the front-end request, directly return the picture name, in front of the mosaic into a complete Web site. This saves both bandwidth and database space. From the actual effect, the flow of traffic in half.
Next consider the static page for compression, online retrieval, found Nginx configuration, you can compress static pages, so the study, configuration, test Web compression tools to test, it is useful, compression rate is relatively high, jquery this tool can compress to 30k, The other we write the JS is fast compression no more. Whim, see our JS call back to the JSON data can be compressed, so configured a bit, the surprise found that Nginx can also be the agent of the data compression, more than 30 K of the data to compress to 1k, basically no more optimization. And do not change the front-end code on it, the browser automatically help us to deal with the process of understanding the compression, no need for human intervention. The following configuration allows gzip on;
Gzip_min_length 1k;
Gzip_buffers 4 16k;
#gzip_http_version 1.0;
Gzip_comp_level 3;
Gzip_types text/plain application/x-javascript text/css application/xml text/javascript Application/json;
Gzip_vary off;
Gzip_disable "MSIE [1-6]\.";
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.