简体   繁体   English

在VM / Vagrant环境中开发Concrete5网站-如何加快速度?

[英]Developing a Concrete5 site in a VM / Vagrant environment - how to speed it up?

I've used VirtualBox / Vagrant to locally develop sites on the following CMS's and platforms: Magento, OpenCart, WordPress and Concrete5. 我已经使用VirtualBox / Vagrant在以下CMS和平台上本地开发站点:Magento,OpenCart,WordPress和Concrete5。

Of all the above, Concrete5 sites are by far the slowest, and can take in excess of 10 seconds to fully load pages. 在上述所有站点中,Concrete5站点是迄今为止最慢的站点,可能需要超过10秒才能完全加载页面。 If logged in, pages can take over 20 seconds. 如果登录,页面可能需要20秒钟以上。

If I enable caching during development, load time is cut to around 6 & 14 seconds for not logged in and logged in sessions respectively. 如果我在开发过程中启用了缓存,则由于未登录和未登录会话,加载时间分别缩短为6和14秒。

I've customised my setup for Concrete5 in an attempt to speed it up, even allocating 4GB of RAM to the VM. 我为Concrete5定制了设置,以试图加快设置速度,甚至为VM分配了4GB的RAM。 I usually allocate 2GB to all other VM's which use the other platforms. 我通常为使用其他平台的所有其他VM分配2GB。 Allocating the extra RAM achieves absolute nothing in terms of performance. 分配额外的RAM绝对无法实现性能。

I've been using CentOS 6.4 as guest OS... 我一直在使用CentOS 6.4作为来宾操作系统...

As mentioned above, it only seems to be Concrete5 that is giving me problems. 如上所述,似乎只有Concrete5在给我带来麻烦。 Has anyone else experienced this, and if so, do you know any particular reason why it is so slow? 有没有其他人经历过这种情况,如果是这样,您是否知道其如此缓慢的任何特殊原因?

Depending on how you have setup your virtual machine, in *Unix environments, you can achieve a big boost by using an opcaching extension in PHP. 在* Unix环境中,根据您设置虚拟机的方式,可以通过使用PHP中的opcaching扩展来获得很大的提升。

I am using OPCACHE with PHP 5.5.x which I found Concrete5.7.x to run really well and against PHP 5.4 or 5.3 using APC for opcaching, the difference is visible. 我将OPCACHE与PHP 5.5.x结合使用,发现Concrete5.7.x确实运行良好,并且针对PHP 5.4或5.3使用APC进行操作,区别是显而易见的。

As of how Opcaching extensions work, it is best to tweak it's settings so it will keep as much as possible of precompiled scripts in RAM, as that boosts any php applications. 至于Opcaching扩展的工作方式,最好对其设置进行调整,以使其在RAM中保留尽可能多的预编译脚本,因为这会增强任何php应用程序。

To mention also, I am setting Concrete5 for suitable for development and don't have problems for things not changing. 还要提一下,我将Concrete5设置为适合开发,并且对于没有变化的东西没有问题。

I managed to semi-solve my question above. 我设法半解决了上面的问题。 Most of my concrete site builds include quite a few jQuery modules / packages. 我的大部分具体站点构建都包含许多jQuery模块/软件包。 I'd been putting these into noConflict mode so they didn't interfere with Concrete5's own jQuery when logged in so I got a pretty good view of the actual site when logged in or in edit mode compared to when not logged in. 我一直将它们设置为noConflict模式,以便它们在登录时不会干扰Concrete5自己的jQuery,因此与未登录时相比,在登录或处于编辑模式时,我对实际站点有了一个很好的了解。

Instead of doing this, I just wrapped all jQuery file includes and inline statements within an if statement as in the following example: 我没有这样做,而是将所有jQuery文件include和inline语句包装在if语句中,如以下示例所示:

<?php
$u = new User();
if(!$u->isLoggedIn()) { ?>

<script>
jQuery here
</script>
<script src="<?php echo $this->getThemePath()?>/js/flex.js"></script>

<?php } ?>

This seems to speed up the site when logged in. 登录后似乎可以加快站点速度。

I already use the if statement above for when using an newer version of jQuery than the 1.7.2 version that Concrete5.6 uses. 当使用比Concrete5.6使用的1.7.2版本更高的jQuery版本时,我已经在上面使用了if语句。

Still, I don't experience this with other platforms - I'll continue to look into this. 不过,我在其他平台上并没有体验到这一点-我将继续研究。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM