我有6GB Ram与我的主机 - 在woocommerce系统状态,它说这是你的wordpress网站可以一次使用的ram数量?
我对此感到困惑 - 我应该将此设置设置为6000M - 我不希望我的所有RAM都专用于我的woocommerce网站,因为它是98%的woocom页面。
从wp-config.php设置
define('WP_MEMORY_LIMIT', '3072M');
这是我目前的设定。
答案 0 :(得分:1)
tl;dr 3072M is far too high for this setting.
It's hard to answer this question without more information about your server environment. Is the server dedicated to your WordPress / Woo instance or are you sharing it with others? Is your MySQL instance running on this same server with your WordPress instance?
You definitely don't want to give all your RAM, or even half of it, to WordPress this way. Why not? Because it's not a shared limit. When your site is busy you have multiple web server processes running, and they each obey the limits you give. If you give them all half your RAM and they take it, your server will thrash, and your web site will work poorly if at all. Thrashing servers sometimes experience hard crashes. You don't want that.
In any case WP_MEMORY_LIMIT
can't set memory limits to exceed the php memory limits in your system. That's probably why your current ludicrously high setting of 3072M
hasn't already brought your site to its knees.
There are separate limits here because some servers use PHP for other things than WordPress.
My suggestion: be very careful messing with this number. Make conservative changes. If you're getting php memory exhaustion errors from WordPress, increase this limit (and the php memory limit) slowly and sparingly until things start to work.
Install a plugin to monitor memory. Here is one: https://wordpress.org/plugins/server-ip-memory-usage/
Keep an eye on your web server error log to see if you're routinely getting memory exhaustion errors.
答案 1 :(得分:0)
这取决于您的网站的内存密集程度。尝试将一些电话记录到memory_get_peak_usage()
以查看。默认情况下,我不会分配超过128 MiB的内存。您不希望代码中的错误占用您所有服务器的可用内存。