PHP performance optimization and php Optimization
 
 
 
 
 
The figure below shows 100 concurrent requests with 1000 target addresses
 
 
 
 
 
 
 
 
 
 
 
 
Test
 
 
 
 
 
 
 
 
Two most important parameters: Requests per second: Number of Requests received per second. Here, 101 Requests are received per second.
 
Time per request: the Time consumed by a request, which is 9 milliseconds
 
The larger the first parameter, the better. The smaller the second parameter, the better.
 
 
 
 
 
Optimization Method-language-level performance optimization 1
 
 
 
 
 
 
 
 
PHP Code Execution Process:
 
 
 
 
PHP code is scanned row by row through the zend engine. It becomes a syntax that the zend engine can understand. transcoding is parsed into Opcodes and output after execution.
 
If you use more built-in functions, the scanning and understanding time will be much faster, the Opcodes will be less, and the execution will be faster.
 
 
 
Optimization Method-language-level performance optimization 2
 
 
 
 
 Optimization Method-language-level performance optimization 3
 
 
Test
 
 
The time php file name can be used to determine the execution time, focusing on the user value, that is, 24 Ms
 
 
 
 Optimization Method-language-level performance optimization 4
 
 
 
 
Optimization Method-language-level performance optimization 5
 
 
 
 
 
Optimization Method-language-level performance optimization 6
 
 
 
 
 
 
Optimization Method-language-level performance optimization 7
 
 
It is better to change it to this mode.
 
 
 
 
 
 
 Optimization Method-language-level performance optimization 8
 
 
 
 
 
 
Optimization Method-language-level performance optimization 9
 
 
 
 
 Optimization Method-peripheral problem Performance Optimization
 
 
 
 
Optimization Method-peripheral problem performance optimization 1
 
 
 
Common php overhead sequence: read/write memory <read/write database (read/write hard disk) <read/write disk <read/write network data (invisible Overhead: network latency)
 
 
 
Optimization Method-peripheral problem performance optimization 2
 
 
 
 
 Optimization Method-peripheral problem performance optimization 3
 
 
 
 
Optimization Method-peripheral problem performance optimization 4
 
 
 
 
Optimization Method-peripheral problem performance optimization 5
 
 
Parallel serial Modification
 
 
 
Optimization Method-peripheral problem performance optimization 6
 
 
 
 
Xhprof tool to analyze PHP Performance
 
 
This command can check whether the software is installed
 
 
 
Installation and Use of xhprof: Http://www.cnblogs.com/bluefrog/archive/2012/03/01/2374922.html
 
Usage illustration:
 
 
 
 
 
PHP performance bottlenecks
 
 
 
 
Finishing from MOOC network video tutorial: http://www.imooc.com/learn/205