One of the advantages of php (as the mainstream development language) is that it is fast. it is enough for general website applications. However, if the site's traffic is high, bandwidth is narrow, or other factors cause a performance bottleneck on the server, you may have to think of other ways to further improve php (as the mainstream development of SyntaxHighlighter. one of the advantages of all (); php (as the current mainstream development language) is that it is fast and enough for general website applications. However, if the site traffic is high, bandwidth is narrow, or other factors cause a performance bottleneck on the server, you may have to think of other ways to further improve php (as the mainstream development language). This article will introduce how to achieve this in several aspects, so that users can be more comfortable browsing ".
Code Optimization
I don't want to tell you again here
I think everyone knows how to write cleaner code. you may already be in php (as the mainstream development language) when you need speed) I have done a lot of work on source code optimization. what I have mentioned here is that this tedious work can be done by other tools. This is Zend Optimizer, which is available for free from Zend Technologies's website (http://www.zend.com. Its principle is very simple. it detects intermediate code generated by the Zend Engine and optimizes it to get a higher execution speed. I think optimizing code is a cumbersome task, and the optimized code may become hard to understand, especially when you put it down (as a mainstream development language) after a period of time, when the customer asks you to make some changes, you may not understand it yourself ;-). Therefore, I suggest you use Zend Optimizer to optimize the source code of php (as the mainstream development language) when it is complicated, the advantage is that it won't make your code complex and difficult to understand.
Installing Zend Optimizer is very simple. You only need to download the relevant pre-compiled libraries based on your platform and use them in your php (as the mainstream development language ). add two lines to ini and restart your web server!
Zend_optimizer.optimization_level = 15zend_extension = "/path/to/ZendOptimizer. so" zend_loader.enable = Off
You may be a bit strange. isn't it just two rows? how is it changed to three rows. However, the third line is optional. it seems that disabling this zend_loader will make optimization faster. Therefore, you may wish to add this line to your php (as the mainstream development language). ini file. Note that zend_loader can be disabled only when you do not use Zend Encoder Runtime. Zend Encoder Runtime is also mentioned below.
Is it faster? Use cache (buffer)
If your php (as the mainstream development language) applications still require faster speed, the next method is buffering. There are several different ways to achieve this. I have tried Zend Cache (evaluation version), APC, and Afterburner Cache myself.
All of the above are "buffer modules ". They all work in the same way. When php (as the current mainstream development language) files are requested for the first time, your php (as the current mainstream development language) the intermediate code of the source code is stored in the memory of the web server. for the same requests in the future, the "compile" version in the memory is provided directly. Since it can minimize disk access, this method can indeed greatly improve the performance of php (as the mainstream development language. More conveniently, when your php (as the mainstream development language) source code is modified, the buffered module can detect these changes and reload them as well, therefore, you do not have to worry about the old version of the program. These buffer modules are really good, but which one should I choose? The following sections describe:
Zend Cache is a commercial product of Zend Technologies (it also provides us with the php (as the mainstream development language) engine and Zend Optimizer for free ). It is really good. After the first run, you can see that the speed of php (as the mainstream development language) has been greatly improved, and there are more idle resources on the server. The disadvantage is that you have to pay for it, but it is very worthwhile for cost effectiveness.
Afterburner Cache is a free buffer module provided by Bware Technologies (bwcache. bware. it. The current version is only a beta version. the work it does seems to be similar to Zend Cache, but the performance improvement is not as good as Zend Cache, and the existing version cannot work with Zend Optimizer, but it is free.
APC (Alternative php (as the mainstream development language) Cache) is another free module provided by Community Connect (apc.communityconnect.com. It works very stably and has a lot of speed improvement. Please note that I have not found an official test data. these are just tests on my application, therefore, we cannot draw a conclusion.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service