PHP-FPM Memory Increased Wordpress/Woocommerce Performance?

Hi, I’m curious if this is just anecdotal evidence or not,

But after increasing my ;php_admin_value[memory_limit] to 1024MB (from the default 32MB)

I’ve seen a considerable speed increase on my 4GB digitalocean droplet (I have about 12 sites on this droplet, and I’ve increased all of their mem-limits to 1024MB for now.

Is this just anecdotal? Or does increasing this value actually increase performance with Wordpress/Woocommerce?

Thank you

You can also increase PHP’s memory limit by going to your server > settings & packages > memory limit.

And yes increasing this does increase performance at the cost of not being able to handle as many connections before you run into problems with all of your server’s resources being used up.

1024MB is kind of high though. This is the memory limit for each individual PHP connection. If multiple people hit the server at the same time, those multiple 1024MB connections could add up to the server exhausting all of its resources and not accepting any more connections. Don’t forget you also have the database and other services using up memory too. In reality though 1024MB is just the maximum amount of space per connection that PHP will use up. It doesn’t mean it will use the full amount. That default of 32MB is way too low. I would say that the sweet spot is somewhere in the middle.

There are some other items you’ll want to change too. These are all located under the “Advanced tab” of the “Settings & Packages” page. There is an in between step where PHP turns its instructions into OP code instructions. The OPcode Cache will cache these instructions. I’ll usually increase the OPCACHE MEMORY from the default value a little. There is the APC cache, I think this is just an alternative to Redis, and is probably not being used. There is the BUFFER POOL SIZE you’ll want to increase it a lot just like you did for PHP’s per-connection memory limit. This provides more memory for the database to use to cache stuff. There is also the KEY BUFFER SIZE which has to do with the legacy MyISAM engine. I would just convert any MyISAM tables to InnoDB, and then you don’t have to worry about the key buffer size.

How would I go about this?

And thank you for the wonderful information. I’m surprised at how little info is available about this on cloudways.

I’ve been battling shit performance on cloudways with woocommerce for almost 2 years now.

Your website shouldn’t be going too slow. Make sure you’re also performing all of [these](https://wp-power.org/wordpress-performance/ultimate-
guide-wordpress-performance/) optimizations.

You can convert to InnoDB by opening up the Cloudways control panel and going to your website > access details, and then launch the database manager. Under the Engine column, it probably already says that each table is using InnoDB, but if you’re not, click on “SQL command” in the sidebar, and run the command.

SET @DATABASE_NAME = '<YOUR DB NAME HERE>';

SELECT  CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM    information_schema.tables AS tb
WHERE   table_schema = @DATABASE_NAME
AND     `ENGINE` = 'MyISAM'
AND     `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;

replacing <YOUR DB NAME HERE> with your DB name.

This won’t do anything yet though. Running this will simply output additional commands that you will need to run. You can run all of these additional commands at the same time.

While your at it, you can also make sure that you are using the same collation everywhere. Below is the command for that. Same thing, replace <YOUR DB NAME HERE>, and copy and paste the output, and run the output of this query as another command. You can also replace utf8mb4_unicode_ci with whatever collation you would like to use. I don’t know the benefits of the different collations, but I do know that you should be using the same collation everywhere for faster joins.

SELECT CONCAT("ALTER TABLE ", TABLE_SCHEMA, '.', TABLE_NAME," COLLATE 	utf8mb4_unicode_ci;") AS    ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="<YOUR DB NAME HERE>"
AND TABLE_TYPE="BASE TABLE";
1 Like

Amazing thank you for this. A quick check showed that my database was already in inno_db.

Nonetheless, performance of the server increased dramatically after increaseing the PHP_FPM, the opcache, and the Buffer pool size.

At a certain number of products, the woocommerce server began to lag BIG time with any functions, which basically made the server inoperable.

Moving forward, I will implement these adjustments on all of my servers.

Thank you Russell

1 Like

I increased the “;php_admin_value[max_input_vars]” from 3,000 to 10,000.

Does this do anything substantial to performance?

Thanks :slight_smile:

Nope.

That just means that if you have https://url.com?varA=something&varB=something&varC=something

You’ll be able to continue adding items to the end of the URL until you reach 10,000 items instead of 3,000. The settings also applies to the number of cookies and post variables that can be used. I’ve never needed to change this setting.