In this Episode 5 of Ask Paul Anything, we’ll discuss what
WP_MEMORY_LIMIT is and how to use it.
Today, I’m going to answer the following question:
What should the
WP_MEMORY_LIMITand WP_MAX_MEMORY_LIMIT be? My site has 10,000 of daily visitors and runs on WordPress and WooCommerce. Also, does memory limit affect the speed of the website?
[0:24] – What Is
For those that don’t know, WordPress offers the option to use a PHP constant, called
WP_MEMORY_LIMIT, to set the maximum memory usage by PHP.
What does That Actually Mean?
Let’s assume your server has 1GB of memory and also that that 1GB is wholly available to PHP.
When someone loads a page, when PHP is instantiated, the maximum memory that that page PHP process can use is X. So, let’s say you set the memory limit to 128MB.
That means that, if your PHP processes all use of the full memory available to them (128MB), you’ll be limited to 8 concurrent PHP processes.
I’m not saying that you can have only 8 processes on your site at 1 time. What I’m saying is:
If each process uses the maximum amount of memory available to them, then that’s the maximum amount of concurrent processes that will be available to your server.
WP_MEMORY_LIMIT does not mean that that’s the amount of memory that the PHP process will use. It’s the amount of memory that PHP process will be allowed to use.
[1:48] – How Does
If you set your memory too low, let’s say 32MB, and your site won’t load, in fact, it’ll probably crash. You’ll get a familiar message that the process exceeded available memory by xxx bytes.
Basically, if PHP goes over your limit, it will crash and nobody wants a crashing site. You would rather have the upper limit to be a little bit higher.
WP_MEMORY_LIMIT is trying to restrain how big a memory footprint that a PHP process can actually make.
[2:43] – What Should The
If a site has 10,000 daily visitors and runs on WordPress and WooCommerce, there’s no way to know what the
WP_MEMORY_LIMIT is. But, it should be at least as big as it needs to be.
Sometimes when a person loads the page it uses 64MB but most of the time he uses only 50MB. Then, the minimum value you should put for your
WP_MEMORY_LIMIT is 64MB.
You should put your minimum value to be whatever the amount of memory that is required for every single page to work.
[3:30] – Does Memory Limit Affect The Speed Of The Website?
No, it doesn’t but in a certain way, it could.
If you make a PHP memory limit very large, then perhaps PHP will clean up after itself a little less often because it’s got so much memory to work with. But I would say no,
WP_MEMORY_LIMIT will not affect the speed of the website.
[04:02] – What Will Affect The Speed Of The Website?
What will affect the speed of your website is:
- how it’s configured;
- number of plugins you’re running;
- the number of visitors you have; and
- how powerful your server is.
What Do You Need Then?
If you have 10,000 of daily visitors on your site, you’re going to need a powerful server.
WP_MEMORY_LIMIT won’t really affect that. What you’ll want to do is to increase the physical memory available to the system.
Thank You! Comments, Questions?
I hope that this gives a little bit of background on the
WP_MEMORY_LIMIT and how it works.
If you have any questions about this or any other questions of your own, please feel free to use the link below. We’d be delighted to answer to them. 🙂
If you’re on YouTube, click to subscribe. If you’re on Facebook, click to “Like” or share.
WP Simple Firewall is essential for WP Security
I have been using this plugin for over a year now and it has performed flawlessly. It certainly makes my life easier with applying WordPess security. I really like the Audit Trail Viewer and how it allows you to view login attempts and more! As a freelance developer on a…
Not much to say. Security that works is quiet.
Excellent security plugin!
For the security plugins I’ve tried, Shield is a “one-in-all” Swiss knife. Broad enough to handle a lot of malicious activities out there. Thank you for developing this awesome plugin, and keep your Excellent work up, Folks!
Miles ahead of Wordfence
I switched from Wordfence to Shield two weeks ago and am glad to have made the decision. I love the simplicity and usability of Shield’s backend design and the free features it has to offer, many of which are not available in any other mainstream security plugin. It also eliminated…
Hey there gorgeous! Do you like what you've read here? :)
If this cool feature is something you'd like, but you haven't gone PRO yet, click here to get started today. (no risk, with a 14-day satisfaction guarantee!)
You'll get all PRO features, including Malware Scanning, WP Config Protection, Plugin FileGuard, import/export, customer support, and so much more. Not only that, you'll get that warm, fuzzy feeling that comes from supporting our work and future development.