May 4, 2018 by Paul G. | Ask Paulie Anything

What is WP_MEMORY_LIMIT and how to use it – Ask Paulie Anything, Episode 5

Shield Logo

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_LIMIT and 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 WP_MEMORY_LIMIT?

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.

So, 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 WP_MEMORY_LIMIT Work?

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.

So, WP_MEMORY_LIMIT is trying to restrain how big a memory footprint that a PHP process can actually make.

[2:43] – What Should The WP_MEMORY_LIMIT Be?

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.

Changing the 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. 🙂

Ask Your Own Question Here.

If you’re on YouTube, click to subscribe. If you’re on Facebook, click to “Like” or share.

ShieldPRO Testimonials
@boozey's Gravatar @boozey

Easy and intuitive – great!

Shield seems so much easier and more intuitive than some of the other security plugins I’ve used, I hope it begins to appear in those lists of ‘Top 5 WordPress Security Plugins’ or ’10 Must Have WordPress Security Plugins’ soon so more people know about it.

@pcritchie's Gravatar @pcritchie

Five Stars

Easy to install and manage, under active development, and does an excellent job. I HIGHLY recommend using wp-simple-firewall on all WP sites. I was looking for a firewall/improved security plugin for a site that was under fairly regular attacks and comment spam and was impressed with the five star rating,…

@billgarrettsr's Gravatar @billgarrettsr

Makes websight building easy.

The title says it all.

@grntrmd1800's Gravatar @grntrmd1800

Best Security Plugin I’ve Tried So Far

I’ve tried a handful of other security plugins (including the heavyweight, prominent ones) and this is the best security plugin I’ve found so far. It has effective spam protection and has helped me to mitigate brute-force login attempts on more than one occasion. The login security is top-notch and I…

Hey there good-lookin'! 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.

Make Me Pro →

Leave a Comment

Your email address will not be published. Required fields are marked *

Click to access the login or register cheese