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. 🙂
Easy to use and works great
The automatic updates are a nice feature, I never have to worry
Really works well
I have been very happy with this plugin.
I love plugins that simply work
Simplicity is an art and most plugins out there are so bloated and full of rubbish and end up making your site slow and vulnerable. This plugin, on the other hand, respects simplicity and respects the user. It does all it says it does without getting in your way. Also,…
Well… Now this is a thing!
Started using this to build a website for my wife’s company. And now I keep trying to think of something else I make a site for. Love Worpress