PHP performance optimization and php Optimization

Source: Internet
Author: User

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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.