Home  >  Article  >  Backend Development  >  Using xhprof (PHP) extension for WEB performance analysis

Using xhprof (PHP) extension for WEB performance analysis

WBOY
WBOYOriginal
2016-07-29 09:10:261303browse

I’ve been a little busy at work recently, often working overtime and occasionally staying up all night. But in the end, the popular Weibo "Mixed Stream" was successfully launched in full. However, from a performance perspective, there is still a lot of room for improvement.

The following is about using xhprof to analyze WEB performance.

Install xhprof extension:

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

Note: If you want to use xhprof drawing, you need to turn on the system default disabled function.

1

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

Deploy xhprof Running environment:

After the above configuration, xhprof will output a report file after you run the project. However, the contents of this file are serialized arrays. Therefore, it is necessary to build a WEB environment that can read the data file.

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

After that, by accessing the xhprof environment, you will see the following report interface.

Using xhprof (PHP) extension for WEB performance analysis

xhprof file list (/xhprof_html/list.php)

Using xhprof (PHP) extension for WEB performance analysis

xhprof report in icon form (/xhprof_html/index.php)

  • Function Name Method name
  • Calls Number of calls
  • Incl . Wall Time The execution time of this function (including the time of other internal function calls)
  • Excl. xhprof report (/xhprof_html/callgraph.php) Some points to pay attention to:
  • The same method has been called too many times (maybe caused by unnecessary loops)

Whether the time consuming falls on the external interface (will Affects TPS – number of requests per second)Using xhprof (PHP) extension for WEB performance analysis

Is there excessive memory consumption (will affect computing efficiency)

Article source: Hu Xu’s personal blog => [Original] Use xhprof (PHP) extension for WEB performance analysis
  • Please indicate the source when reprinting, any offenders will be prosecuted!
  • The above introduces the use of xhprof (PHP) extension for WEB performance analysis, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn