Introduction to Web Performance optimization
The first criterion of performance optimization: 加缓存
. Almost the majority of optimizations are made around this. Let users see the results as quickly as they can.
Second criterion for performance optimization: 最小原则
. No excess information is provided. For example, static resources (image, CSS, JS) compression, image scrolling loading, asynchronous requests, HTTP request merging, and so on.
Third criterion for performance optimization: 分布、集群
. At present, the premise is that the basic optimization has been done, before considering this aspect.
Ideas
Performance optimization process is a chain, any one node should be optimized, otherwise all will be wrong, optimization also failed.
These aspects are included on each node
- Positioning. Whether there is a performance problem locating this node.
- Monitoring. Monitor the performance of this node.
- Solution to the problem (document). Reduce the cost of solving problems artificially.
The following article is also based on the process, a node of one node to organize
Performance type
These include, but are not limited to, the following types. The following are only based on the technology our team uses. If more technology can be used to add, such as: CDN cache acceleration and so on.
Browser
A browser is the first procedure that a user touches. Often the optimization here is straightforward, simple, and the effect will be very good.
- Resource static Cache
- Resource static on-demand loading
Internet
At present, the network is still a more serious performance bottleneck. Commercial enterprise bandwidth is also more expensive, so optimization is very necessary.
- Merge request
- Compressed transport (GZIP)
- Response Content for compressed HTTP
Server
The first step is to ensure that each software itself is optimized, and that the application scenario for the corresponding software is optimized.
- Operating System (Linux)
- Proxy (Nginx)
- Web container (Tomcat)
- Web Application (Java)
- Database (MySQL)
Architecture
A unified solution to the architecture allows development to reduce performance considerations in certain programs.
- Business planning. For example: static and dynamic separation, and the use of different domain names.
- Distribution. Deploy important applications and provide services independently.
- Cluster. Cluster + load uniformity is a direct problem to solve the performance. But finally put in all the performance is already the best case, then consider the cluster. This will reduce operation and maintenance costs and capital costs.
- Cached. The content that hits the hotspot, and uses the cache very often. Consider the scenario and hit ratio to use.
- Static. It is a great idea to take the unchanging content of the year to a standstill. It is best to make it transparent to the business without affecting it.
Software development
Many performance problems are generated during the development process.
- High-performance design. For example: Reasonable database field redundancy. such as the complexity of the algorithm.
- High-performance specifications. For example: Do not allow IO in for.
- High-performance standards. Each business should have a standard that exceeds this standard to be optimized. Not every one has to be optimized, which also affects development efficiency. Purposeful optimization, 8/2 scale. Use 20% of the time to resolve 80% performance issues.
Framework
- Message Queuing. Solve complex scenarios without the need for users to wait. If the effectiveness of the solution is not so strong business.
Language (Java)
Optimization of the virtual machine.
Process
Be familiar with processes and nodes in order to locate performance issues. and the order of optimization is generally optimized by the requested process. The process here is simply a summary and does not represent comprehensiveness.
The entire process is the fastest way to let users see the results
Recurring questions
If there is a duplicate problem, it is given to the higher-level node (the previous node in the process) to resolve. For example, if you can do static and caching at the proxy level, do not implement it in the Web container, let's not do it in a Web application.
Uniform Structure of documents
- Scene
- Solution Solutions
- Validation methods
Higher target Imagination
These capabilities are achieved through cloud computing.
Web Performance optimization