PHP program accelerated exploration [2] - Introduction and preface

xiaoxiao2021-03-06  101

(1) Introduction

This article attempts to explore all aspects of PHP program acceleration, including necessity, and specific measures taken from different angles. I hope that the reader understands the acceleration of the PHP program and is applied to the actual.

(2) Do you need to accelerate?

This problem sounds a bit stupid. In this era, few people will suspect that time is the most precious wealth, especially in the commercial market. The faster the program is executed, the more users save, so your program can use less time and server resources to serve more benefits.

I want to speaking most people (including myself), many web projects are all completed in very nervous time, usually have no dense thinking and strict testing. When starting a new web project. Many people build the "fast and chaotic" application, lack the necessary time to adjust and improve the code, and the optimization and acceleration is what we must take.

However, it is important to point out that not all programs need to be accelerated.

Optimizing the completed code is very wasteful, the best way is to pay attention to efficiency when writing code, and then only optimized the part of the other. Generally, a program will only have a few bottlenecks that affect speed, find them and resolve, and the program can run well. In addition, when the implementation efficiency is low, we must first use the overall vision to find the main factors affecting efficiency, not to stick to details - such as excessive data volume, and the server bandwidth is not enough, or the hardware configuration is too low. Optimizing the code is not suppressed.

In addition, when there is no obvious sign of the discovery procedure, don't be too hot, and waste time in order to improve some very detailed code. With these times, you can complete another project or complete an extension function for the original project. Of course, you can joke, I don't be responsible, I have not made my work well, I can also say that you are perfei :-)

In summary, ask you if you have necessary you have to ask yourself before you decide to speed up your PHP program.

(3) How to accelerate?

To answer "How to Accelerate", you need to answer the following two small questions first:

1. Which part is your program?

2. What kind of as PHP can consider acceleration?

The first small problem obviously I can't give you an answer, but I suggest you solve it with the "test script execution speed" method. Only bottlenecks that limit the limit speed can be considered to solve it.

The second small problem I probably the answer is: code optimization, compression output, content cache output, function cache output, acceleration / cache tool software. If you know more, please tell me :-)

Below we will study the related techniques of these aspects in detail. Of course, there are countless details that can be discussed in every aspect. The following content will inevitably have a side place, welcome to supplement.

转载请注明原文地址:https://www.9cbs.com/read-123855.html

New Post(0)