简体   繁体   English

一个共享的Magento开发环境需要多少内存?

[英]How much memory do I need for a shared Magento development environment?

We're using a shared server (on RackSpace) for Magento development. 我们正在使用共享服务器(在RackSpace上)进行Magento开发。 Each developer has his own sandbox, but PHP's memory_limit = 512M and when I try to inspect some objects [with Mage::log($someBigArray)] , I get failures, and Apache logs this: 每个开发人员都有自己的沙箱,但是PHP的memory_limit = 512M并且当我尝试使用[ Mage::log($someBigArray)]检查某些对象时,我失败了,Apache记录以下内容:

[Mon Jan 23 15:47:35 2012] [error] [client 208.247.73.130] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 228065281 bytes) in /home/msmith/projects/ref/app/Mage.php on line 761, referer: http://ref.msmith.mage.example.com/checkout/cart/

My boss wants to increase the memory so that we can do this kind of logging. 我的老板想增加内存,以便我们可以进行这种记录。 Currently we only have three developers on the box, but we want to be able to increase up to 15. How much memory would be appropriate to set for memory_limit in php.ini to support that many developers on a shared server? 目前,我们只有3个开发人员,但我们希望最多可以增加15个。为支持共享服务器上的许多开发人员,在php.ini中为memory_limit设置多少内存是合适的?

  1. As much as you can, although 15 developers aren't that many if you consider the amount of traffic you'll be bringing to your store once you launch 尽您所能,尽管如果考虑到发布后将带给您商店的流量,那么15个开发人员并不多

  2. All the memory in the world won't fix your Allowed memory size of 268435456 bytes exhausted error. 世界上所有的内存都无法解决您Allowed memory size of 268435456 bytes exhausted错误。 These errors crop up when PHP encounters circular recursive links between objects and keeps spooling infinite string representations into memory. 当PHP在对象之间遇到循环递归链接并不断将无限字符串表示形式假脱机到内存中时,这些错误就会出现。 Magento has a lot of these circular references. Magento有很多这样的循环参考。

You aren't using 512MB yet - note the allowed memory size indicated in the error log. 您尚未使用512MB,请注意错误日志中指示的允许内存大小。 In addition to PHP.ini, Magento sets the memory limit in several places, at least in my distribution (a BitNami image on Linux). 除了PHP.ini,Magento还在多个地方(至少在我的发行版中)设置了内存限制(Linux上的BitNami映像)。

In htdocs I have .htaccess with: 在htdocs中,我具有.htaccess:

############################################
## adjust memory limit

#    php_value memory_limit 64M
    php_value memory_limit 256M
    php_value max_execution_time 18000

This affects much of the application. 这会影响很多应用程序。 There are also a few places in the code with 代码中还有一些地方

    @set_time_limit(0);
    @ini_set('memory_limit', '256M');

You can grep for these. 您可以grep这些。

If the large array you are wanting to dump to the log is a Varien_Object, you could try dumping it like this: 如果要转储到日志中的大型数组是Varien_Object,则可以尝试这样转储它:

    Mage::log(
        "My object: " .
        print_r($object->debug(),true),
        null,
        'MyLogfile.log'
    );

The debug method stops infinite recursion, but this will only work for sub classes of Varien_Object. debug方法将停止无限递归,但这仅适用于Varien_Object的子类。 Fortunately, many of the objects in Magento are derived from Varien_Object. 幸运的是,Magento中的许多对象都是从Varien_Object派生的。

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

相关问题 如何在xampp开发环境中在CodeIgniter中加载css? - How do I make the css load in CodeIgniter in an xampp development environment? 如何在php中创建用于开发的工作环境? - How do I create working environment for development in php? Magento:如何将配置更改从开发环境迁移到生产环境? - Magento: How can I migrate configuration changes from development to production environment? 尝试克隆Magento 1.4.x网站进行开发,如何调试死亡白屏? - Trying to clone Magento 1.4.x site for development, how do I debug the white-screen-of-death? 我如何知道我的 php 脚本使用了多少内存/资源? - How do I tell how much memory / resources is my php script using up? 我怎么知道我的PHP应用程序是否使用了太多内存? - How do I know if my PHP application is using too much memory? 在共享开发环境中覆盖PHP.ini - Overriding PHP.ini in a shared development environment 如何使Linux服务器在共享环境中使用本地PHP.ini? - How do I get linux server to use local PHP.ini in a shared environment? PHP的内存多少是太多 - php memory how much is too much 我需要在此示例magento代码中避免sql注入吗? - Do i need to avoid sql injection in this example magento code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM