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
@alextc's Gravatar @alextc

Very happy

This plugin is simple to set up and so far no issues, keep up the good work!

@erikbaars's Gravatar @erikbaars

Fantastic Support

Plugin is easy to follow & setup and if you have specific questions they respond extremely quickly and are always friendly (even if you’re query ends up being unrelated!).

@grandt's Gravatar @grandt

Simple Firewall Plugin

This plugin makes the best protection overall I’ve tried a lot of security plugins, but this one does not force you to upgrade to a pro version. And why should it? I’ts already a Pro version! For Free! I can’t think of any other plugin where you get so much…

@snowme's Gravatar @snowme

Great Plugin and Even Better Support

I had an issue getting the Rename Login setting to work. I posted to their support forums and got immediate and constant responses. They even provided an updated version of the plugin to help with my troubleshooting. In the end it turned out to be an issue with my Apache…

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.

Make Me Pro →

Leave a Comment

Your email address will not be published.

Click to access the login or register cheese