Symfony2 应用程序在 VirtualBox 中非常慢 [英] Symfony2 application very slow in VirtualBox

查看:43
本文介绍了Symfony2 应用程序在 VirtualBox 中非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VirtualBox 上运行 Debian 的虚拟副本,以在 nginx/php5-fpm/MySQL 堆栈上开发更大尺寸的 PHP 应用程序.开发发生在主机操作系统 (Windows 7 x64) 中,代码作为共享文件夹安装在来宾操作系统中.

I run a virtual copy of Debian on VirtualBox to develop a larger-sized PHP application on a nginx/php5-fpm/MySQL stack. Development happens in the host OS (Windows 7 x64), the code is mounted as a shared folder in the guest OS.

性能很差.以下是本机 vbox 文件系统和带有 cifs 的 samba 挂载的 webgrind 输出:

Performance is very bad. The following are webgrind outputs for the native vbox filesystem and a samba mount with cifs:

在任何一种情况下,filemtimefile_existsis_readable 都需要几秒钟才能运行.CPU负载很高,内存使用情况正常.

In either case filemtime, file_exists and is_readable take several seconds to run. CPU load is very high, memory usage seems normal.

这三个函数的输出不是都缓存在stat缓存中了吗?为什么他们需要这么长时间?

Isn't the output of all three of these functions cached in the stat cache? Why are they taking so long?

我真的很感激我能得到的任何帮助!

I'd really appreciate any help I can get!

澄清一下,生产性能很好.在我们的(适当的、非虚拟的)临时服务器上,PHP 代码在生产设置中最多执行约 60 毫秒,而在开发模式下执行时间在 100-200 毫秒之间.

To clarify, production performance is fine. On our (proper, non-virtual) staging server the PHP code executes in ~60ms max in production settings and somewhere between 100-200ms in dev mode.

我需要帮助弄清楚为什么 VirtualBox 在开发和运行中慢 100 倍生产模式.

I need help figuring out why VirtualBox is 100x slower in dev & prod mode.

我刚刚检查过,生产设置产生约 5 秒的执行时间.仍然无法使用,而且开发起来很尴尬.

I just checked, production settings yield ~5sec execution. Still unusable, plus it's awkward to develop with.

推荐答案

使用 nfs 文件共享.Samba 和 vbox 文件共享可能非常慢.

Use nfs file sharing. Samba and the vbox file share can be very slow.

您的分析表明文件系统操作是瓶颈.

Your profiling indicates that file system operations are the bottleneck.

阅读这篇博文 http://clock.co.uk/tech-blogs/virtualbox-404-shared-folder-update 以获得更多见解

Read this blog post http://clock.co.uk/tech-blogs/virtualbox-404-shared-folder-update for more insight

这篇关于Symfony2 应用程序在 VirtualBox 中非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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