Experience in accelerating Website access
I have operated several small sites without making any profit. To save costs, I chose a low configuration and the bandwidth is 1 Mbps.
Some time ago, I made several carousel images on the home page of my personal website. The images were still relatively large and the display became slower.
Therefore, I would like to summarize some experiences on accelerating Website access.
1. File compression
Javascript, CSS, and other static resources are compressed. There are many compression tools on the Internet. We recommend that you compress them into a "programmable" one.
You can also enable gzip compression, which has not been tried yet.
It is also necessary to compress large images. Nowadays, the pixels of mobile phones are very high. A photo is 3 MB or more, which is quite scary.
It is necessary to compress images using Freemarker and other image processing tools. To some extent, distortion is acceptable.
2. multi-domain deployment
It is said that when a browser loads resources, a maximum of 5 ~ Six threads. (Not demonstrated)
If this is the case, you can put JS and images in a subdomain name separately.
For example, we usually place images on a single server and use a separate domain name, img.a.com.
3. CDN Acceleration
CDN acceleration is free of charge on the Internet. Of course, the traffic is limited.
It is good to use CDN for images and JS, and it is too expensive to purchase the bandwidth by yourself. Each 1 Mbit/s increase in bandwidth costs several hundred yuan a year.
For CDN, I think we can do this:
In the program, configure one variable, such as useCdn = true, to mark whether to use CDN.
You can use templates such as Freemarker to determine whether to use CDN resources or local resources.
4. Put JS in the final load
To speed up page loading, as webpage files, the order of loading is from top to bottom. Putting styles and js files on top will naturally load them first. (Copy)
5. Use Nginx to respond to static Resources
Theoretically, Nginx responds to static resources with higher performance than Tomcat and Tomcat is higher than SpringMVC.
6. Configure multiple servers
To be honest, at present, the Development and O & M websites have basically not been deployed on multiple servers, because one server is enough, and in most cases, there will be no problems.
It is also a good idea to configure multiple servers for multiple reasons.
7. cache and static
Cache the infrequently changed data.
Static html pages.
Accelerate the response speed.
Static Page, you still need to try.
8. Use third-party testing tools
The Baidu webmaster platform and the 360 webmaster platform can detect Website access conditions. Based on feedback from these tools, they can speed up one by one based on their own situations.
9. Other Methods
My personal website has limited experience. I only summarized some of the methods I have tried or used. More acceleration methods can be used by Du Niang.
Ray FansUnion
February 10, 2015
Hubei-Wuhan-xunlimen