Symfony2初始化时间慢 [英] Symfony2 Slow Initialization Time

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

问题描述

我在Ubuntu Server 12.04(64位)VM(VirtualBox)上运行了Symfony2.主机是MacBook Pro.由于某种原因,我在开发模式(app_dev.php)中的请求时间非常长.我知道在开发模式下它的速度较慢,但​​每个请求的谈话时间为5-7秒(有时甚至更慢).在我的Mac上,开发模式下的请求时间约为200毫秒.

I have Symfony2 running on an Ubuntu Server 12.04 (64-bit) VM (VirtualBox). The host is a MacBook pro. For some reason I am getting really long request times in development mode (app_dev.php). I know its slower in dev mode, but I'm talking 5-7 seconds per request (sometimes even slower). On my Mac I get request times of 200ms or so in development mode.

在Symfony2探查器中查看了我的时间线后,我注意到〜95%的请求时间是初始化时间".这是什么?可能会这么慢的一些原因是什么?

After looking at my timeline in the Symfony2 profiler, I noticed that ~95% of the request time is "initialization time". What is this? What are some reasons it could be so slow?

此问题仅适用于开发模式下的Symfony2,不适用于我在VM上运行的任何其他站点,甚至不适用于生产模式下的Symfony2.

This issue only applies to Symfony2 in dev mode, not any other sites I'm running on the VM, and not even to Symfony2 in production mode.

我看到了这个(http://stackoverflow.com/questions/11162429/whats-included-in-the-initialization-time-in-the-symfony2-web-profiler),但它似乎没有回答我的问题.

I saw this (http://stackoverflow.com/questions/11162429/whats-included-in-the-initialization-time-in-the-symfony2-web-profiler), but it doesn't seem to answer my questions.

推荐答案

我找出了问题的原因(不是Symfony2).由于ubuntu VM上的某些原因,某些文件的修改时间不正确(例如,将来等).当symfony2使用filemtime()针对其注册表检查这些时间时,它将确定缓存不再新鲜,并重新构建整个内容.我还无法弄清楚为什么这样做.

I figured out the cause of the problem (and its not Symfony2). For some reason on the ubuntu VM, the modification times on certain files are incorrect (ie in the future, etc). When symfony2 checks these times using filemtime() against its registry, it determines that the cache is not longer fresh and it rebuilds the whole thing. I haven't been able to figure out why it is doing that yet.

这篇关于Symfony2初始化时间慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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