在生产中分析慢速 PHP 页面 [英] Profile slow PHP pages in production

查看:65
本文介绍了在生产中分析慢速 PHP 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以只分析生产服务器上缓慢的 PHP 页面?

Is there a way of profiling only slow PHP pages on a production server?

目前我们正在将慢速页面记录到文本文件中,但如果没有更多信息,很难说为什么它们很慢(并非一直很慢).

At the moment we're logging slow pages to a text file, but without more information it's hard to say why they're slow (not consistently slow).

我之前使用过 Xdebug 分析器,但我真的不想启用这在我们的生产服务器上,因为我们每秒可能会收到 100 个请求.我也使用过 Zend Platform,但我真的不想再安装它.

I've used the Xdebug profiler before, but I really don't want to enable this on our production servers as we are likely to get 100's of requests per second. I've also used Zend Platform, but I don't really want to install that again.

推荐答案

您可以更改 Apache/HTTP Server 日志以记录服务每个请求所花费的时间.按照 例如本指南.然后你可以收集每个请求需要多长时间的数据,识别慢页面/请求并使用 XDebugWebGrind 以进一步分析原因.

You might alter your Apache/HTTP Server logs to record the time spent serving each request. Follow this guide for example. Then you can gather data for how long each request takes, identify the slow pages/requests and use XDebug or WebGrind to further analyse the causes.

简单,并且不会消耗您的生产服务器.

Easy, and no great drain on your production server.

这篇关于在生产中分析慢速 PHP 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆