缓慢的PHP脚本-自动调试和诊断? [英] Slow PHP script - automatic debug and diagnosis?

查看:74
本文介绍了缓慢的PHP脚本-自动调试和诊断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当每秒有成百上千的用户运行时,如何确定PHP脚本是否变质并且运行速度真的很慢,而且更好的是,有没有工具可以告诉我代码的哪一部分会使我变慢? ...

How can I find out whether a PHP script goes bad and runs really slow when ran by hundreds of users every second, and better yet, is there any tool that could tell me approximately which part of the code slows me down? ...

我不希望在此处发布代码(主要是因为该问题涉及其他内容,并且这是在浪费空间),并且最好不要将其发布在任何地方,因为它实际上是一团糟!是的,我编写了代码,但是仍然一团糟,这会侮辱任何试图理解它的人……因此,如果您有任何创意,请让我知道!

I don't wish to post the code here (mainly because this question refers to something else and because it's a waste of space) and preferably never post it anywhere because it's actually a mess!... a mess that I understand and yes, i coded it, but still a mess which would insult anyone trying to comprehend it... so if you have any creative ideas, please let me know!

干杯!

(已经感谢您的来信!)

( thank you already for your incoming answers! )

推荐答案

启用 XDebug分析,并将结果发送给通过 WinCacheGrind (Windows)或

Enable XDebug profiling, and send the resulting files through WinCacheGrind (Windows) or KCacheGrind (Linux).

这将使您看到哪些函数被调用最多以及花费时间的明细.对于任何认真的PHP开发人员来说,学习使用XDebug都是必须的.

This will allow you to see a breakdown of which functions get called most, and where the time is spent. Learning to use XDebug is a must for any serious PHP developer.

这是一个关于XDebug分析入门的看似不错的教程.

这篇关于缓慢的PHP脚本-自动调试和诊断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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