如何优化 Zend 框架

发布于 2025-01-02 14:18:24 字数 397 浏览 4 评论 0原文

我有一个基于 Zend Framework 构建的应用程序,我正在尝试优化。

我做了一些 Xdebug 分析,虽然我不能说我理解得到的结果的每一个细节,但从结果中有些事情是非常明显的。

例如,Bootstrap.php 文件似乎是消耗时间最多的文件,耗时 4,553MS 秒,占总时间的 92.49%。

如果我进一步挖掘,我可以看到 Zend_Application_Bootstrap_Boostrap->run 占用了大部分时间。再次检查,我发现 Zend_Controller_Front->Dispatch 实际上可能是 Boostrap.php 中需要时间执行的函数。

问题是,根据我拥有的这些索引,我如何才能最好地优化应用程序?如果它缓存,我该如何将缓存应用于这种情况?

谢谢

I have a application built on Zend Framework I am trying to optimize.

I did some Xdebug profiling and although i cant say i understand every nitty gritty of the results i got, some things were quite obvious from the result.

For instance, the file Bootstrap.php seems to be the one gulping most of the time taking 4,553MS seconds which accounts for 92.49% of the total time.

And if i dig further, I could see that Zend_Application_Bootstrap_Boostrap->run takes the bulk of the time. Checking this out again, I found out that Zend_Controller_Front->Dispatch might actually be the function inside the Boostrap.php that takes time to execute.

Question is, from these indices that i have, how best can I go about Optimizing the application? If it caching, how do i go about applying Caching to this situation?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜你已久 2025-01-09 14:18:24

从 callgrinds 的外观来看,在登录页面上,应用程序大部分时间都花在了curl_exec上,如果您正在进行远程登录,这是可以预料到的。但它正在执行 10 次单独的curl_execs,这似乎过多。我不熟悉 LinkedIn 登录身份验证,但您的应用程序是否可能多次运行远程登录代码?

在标准页面请求上,应用程序大部分时间都花在连接 MySQL 上,并且似乎执行了两次。您是否使用远程数据库服务器,并且是否需要两个单独的数据库连接?

假设您正在使用远程数据库服务器,并且它与您的 Web 服务器位于同一网络上,那么那里似乎存在一些网络问题。如果可以的话,我会检查该服务器的延迟,并尝试连接到 IP 地址而不是主机名,看看这是否有任何区别(如果这样做速度更快,则表明您的网络上的 DNS 设置存在问题)服务器)。

From the look of the callgrinds, on the login page the app is spending most of it's time in curl_exec, which is to be expected if you're doing a remote login. But it is doing 10 separate curl_execs which seems excessive. I'm not familiar with the LinkedIn login auth, but is it possible your app is running the remote login code multiple times?

On the standard page request the app is spending most of its time connecting to MySQL, and it seems to be doing this twice. Are you using a remote DB server, and do you need two separate DB connections?

Assuming you are using a remote DB server and it is on the same network as your web server, there seems to be some networking issue there. I'd check the latency to that server if you can, and try connecting to the IP address instead of a hostname to see if that makes any difference (if doing this is much faster this would suggest an issue with the DNS setup on your web server).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文