Symfony2:页面加载缓慢 [英] Symfony2: Slow page loads

查看:23
本文介绍了Symfony2:页面加载缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Ubuntu 虚拟主机上设置 Symfony2.然而,即使是简单的 hello world 页面也需要大约 7-8 秒才能加载.我试过运行其他应用程序,例如 PhpMyAdmin,它们运行良好,但我不明白为什么 symfony 需要这么长时间才能加载.

I am attempting to setup Symfony2 on an Ubuntu virtual host. However even the simple hello world page is taking around 7-8 seconds to load. I have tried running other applications such as PhpMyAdmin and they are running fine but i cannot figure out why symfony is taking so long to load.

以下是一些 webgrind 结果:

Here are some webgrind results:

很抱歉,我目前无法提供更多信息,但我不确定在哪里查看.提前致谢.

Im sorry i cant provide any more information at the moment but im not sure where to look. Thanks in advance.

丹尼尔

推荐答案

尝试完全禁用 Xdebug.

我注意到在 Symfony 1.3/1.4 中,当 Xdebug 的分析器运行时,我的页面加载时间需要 40% 以上来加载.我还没有在 Symfony 2.0 中尝试过 Xdebug,但我想类似的结果会随之而来.

I noticed in Symfony 1.3 / 1.4 that my page loads took 40%+ longer to load when Xdebug's profiler was running. I haven't tried Xdebug with Symfony 2.0 yet, but I imagine similar results would ensue.

问题在于 Symfony 是一个大型框架,它为您做了很多的后台处理.当 Xdebug 对此进行分析时,您的页面将需要更长的时间来加载.

The problem is that Symfony is a large framework that does a lot of background processing for you. When Xdebug is profiling this, your pages will take a lot longer to load.

您最好的办法是为您的浏览器下载一个插件,该插件允许您仅在需要使用时将探查器标志发送到服务器.Xdebug 可以根据要求设置为配置文件.

Your best bet is to download a plugin for your browser that allows you to send the profiler flag to the server only when you need to use it. Xdebug can be setup to profile on request.

以下是我的开发盒上当前的 Xdebug 配置:

Here are my current Xdebug configurations on my development box:

xdebug.remote_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req

xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "c:\var\profile\"
xdebug.profiler_output_name = "cachegrind.out.%t"

这篇关于Symfony2:页面加载缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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