This article attempts to explore various aspects of PHP program acceleration, including the necessity and specific measures taken from different perspectives. Hope to help readers understand the PHP program acceleration and apply it to reality.
(2) is acceleration required?
It sounds silly. In this era, few people doubt that time is the most valuable asset, especially in the commercial market. The faster the program runs, the more time the user saves. In this way, your program can use less time and server resources to serve the user, thus generating more benefits.
I think for most people (including myself), many WEB projects have been completed in a very short time and are usually not carefully considered and strictly tested. Start a new WEB project. Many people are building fast and messy applications and lack the necessary time to adjust and improve code. Optimization and acceleration are the measures we must take.
However, not all programs require acceleration.
It is a waste of time to optimize the completed code. The best way is to pay attention to the efficiency when writing the code. After the project is completed, only the part that needs to be optimized is optimized. Generally, a program only has a few bottlenecks that affect the speed. You can find and solve them to run the program well. In addition, when the execution efficiency is low, we should first look at the overall situation to find out the main factors that affect the efficiency, rather than sticking to the details-for example, the data volume is too large and the server bandwidth is insufficient, or the hardware configuration is too low. In this case, optimization code is useless.
In addition, when there are no obvious signs of slow execution in the program, do not be too picky. It is a waste of time to improve some very detailed code. With this time, you can complete another project or complete an extension function for the original project. Of course, you can joke that I am not responsible enough to do my job well. I can say that you are a perfectionist.
In summary, before you decide to speed up your PHP program, ask yourself if it is necessary.
(3) how to accelerate?
Before answering the question "how to accelerate", you need to answer the following two questions:
1. Where is your program slow?
2. Which of the following aspects can PHP accelerate?
Obviously, I cannot give you the answer to the first small question, but I suggest you use the "test script execution speed" method to solve it. How to solve this problem can be considered only by identifying the bottleneck that limits the speed.
The second small question is my approximate answer: code optimization, compression output, content cache output, function cache output, and acceleration/cache tool software. If you know more, please let me know.
Next, let's take a detailed look at the relevant technologies in these aspects. Of course, there are countless details in every aspect to discuss. The following content will inevitably be one-sided. Please add it.