WEB performance analysis using xhprof (PHP) extension

Source: Internet
Author: User
: This article mainly introduces the use of xhprof (PHP) extension for WEB performance analysis. For more information about PHP tutorials, see. Recently, my work has been a little busy. I often work overtime and occasionally stay up all night. However, the popular Weibo "mixed Stream" was successfully launched in full. However, from the performance perspective, there is still a lot of room for improvement.

The following describes how to use xhprof to analyze WEB performance.

Install xhprof extension:

Official documentation is better than everything => http://php.net/xhprof

Note: If you want to use xhprof for plotting, you need to enable the function disabled by default.

1

;disable_functions = phpinfo,system,exec,shell_exec,passthru,proc_close,show_source

Deploy the xhprof runtime environment:

After the above configuration, xhprof will output a report file after you have run the project. However, the content of this file is a serialized array. Therefore, you need to build a WEB environment that can read the data file.

Here is a copy of xhprof environment code: http://pan.baidu.com/s/1bnLvmrl

Then, you can see the following report page by accessing the xhprof environment.

Xhprof file list (/xhprof_html/list. php)

Xhprof report in the form of icons (/xhprof_html/index. php)

  • Function Name
  • Number of Calls to Cils
  • Incl. Wall Time: the execution Time of the function (including the Time when other internal functions are called)
  • Excl. Wall Time: The Time when the function is executed (excluding the Time when other functions are called)

Xhprof report in flowcharts (/xhprof_html/callgraph. php)

Notes:

  • The same method has been called multiple times (maybe caused by unnecessary loops)
  • Whether the time consumption falls on the external interface (affects TPS-number of requests per second)
  • Whether there is excessive memory consumption (which will affect the computing efficiency)

Source: Hu Xu personal blog => [original] WEB performance analysis using xhprof (PHP) extension

Reprinted, please indicate the source, the offenders must investigate!

The above introduces the use of xhprof (PHP) extension for WEB performance analysis, including the content, hope to be helpful to friends interested in PHP tutorials.

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.