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

查看:26
本文介绍了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天全站免登陆