Speaking of website performance, it seems to be a matter of system architecture. This is far from the case.
Good design code and poor design code can be of an order of magnitude different under the same architecture.
Many technical decision makers prefer to focus on some big aspects, rather than or unwilling to solve the real problems in the most economical way.
It may also be influenced by the concept that "hardware is cheap, while programmers are expensive", so they tend to choose a more easy and decent way to show their achievements.
In fact, the first step to optimizing performance should begin with the design and Code itself, followed by the introduction and use of architecture-level solutions (remember that this requires additional operational costs ).
No matter who it is, it is step-by-step when designing and writing a system. It is impossible to implement everything from the first version, so this provides space for subsequent optimization.
In the beginning, features are always given priority, and scalability and performance are put behind consideration. However, in the overall design, you must consider providing a basic framework for performance optimization.
The overall system design should follow the following principles:
1. Try not to use
2. cache as much as possible
3. Try to compress
4. Try to reuse
5. reasonable redundancy
6. Reasonable Indexing
7. Introduction priority
8. Introduction of distributed
9. Introduce asynchronous and callback
10. Implement as much memory as possible
The first principle should be followed.Dynamic Loading/modularization/configurable/fine-grained usage policies,
Configurable/fine-grained means that you can use fine-grained configuration to control system function options, execution processes, and locations,
For example, the data to be used, the object to be created, the check to be executed, and the location to be placed (ex: CSS in the JS directory ).
The second principle should be followedMulti-layer cache policies. Your system should support:
*) Page cache, local cache, query cache, Web Service cache, data model cache, object cache, configuration cache, code cache, and resource cache.
*) And supports multiple caching methods. For example, you can easily select between the file and the memory cache.
*) On the page cache, the system should support quasi-static page cache and static page cache. All possible static pages should be static. Static functions should be provided in a configurable System Extension plug-in.
*) Put any third-party services and libraries introduced on the third-party CDN, which is usually faster than on your own server, and saves traffic.
*) Introduce cache configuration wherever the results (such as URL parsing and code parsing) need to be parsed at a time and affect the performance.
Following the third principle usually means processing resources, automatic adjustment and restriction of slice size, simplification and merging of resource files, and enabling of server compression functions.
Following the fourth principle, you need to simplify the code as much as possible, design exquisite basic classes, reusable methods, and share data.
Article 5 and six principles refer to the process of accelerating query, browsing, and data statistics through redundant fields and indexes.
Article 7 The principle is that a simple QoS can be designed to classify user requests and prioritize them, such as text processing, image loading delay, and image loading progressively, such as VIP processing.
The eighth principle refers to dynamically changing the request distribution through configuration at the data layer. This configuration can also match the preset mode.
Article 9 refers to the use of technologies such as Ajax, message queue, subscription push, and data bus to reduce waiting time and weaken coupling.
Article 10 refers to the design of a dynamic usage mechanism that can schedule storage devices according to the read/write frequency of data.
The careful and patient practice of the above design ideas will save a lot of operation costs caused by rough design, and help simplify the system architecture to the maximum extent.
Iefreer