Site slowdown because of MEMBERSHIP_LEVELS variable

Hello,

I just started to administrate a site with Wordpress and s2Member, I wanted to update all the parts because of recently bugs found on WP that let an attacker to gain access to my site/server. So I can update all without issues until It’s the turn of s2member plugin. It just hangs the site, after a lot of test and some plugin discard proccess I found that the culprit is s2Member. On my wp-config.php file Is set a variable MEMBERSHIP_LEVELS to 50, If I comment it, the site start to work again so I don’t know what is happening. I installed a query analizer plugin to check the performance and after a few tests with other values under 20 levels, I found that Wordpress is doing more than 400 querys to my DB slowing down a lot the performance. Our user table have more than 300.000 users and I figured out that this varible triggers a massive update to options database on each click. How I can handle this situation to let my site work with the latest version of s2Member at light speeds?

P.D. My site run over php7 with a Percona flavored Mysql Database and Redis for caching.

Best regards.

How many s2Member levels does your site actually have?

What are you using Redis for? If it’s object caching, that often causes problems with s2Member.

Are you using OpCache? You should be.

Hi Tim,

Thank you for your reply. I’m using Redis for caching DB querys, but it is not caching the update querys that s2Member is doing after update to latest version. In the other hand Redis was working flawlessly with the previous version of s2Member.

About the levels we are using 11 leveles right now but the previos admin configured this to 50 but I don’t know why because we don’t use actively all 50 levels. Finallly we aren’t using OpCache I don’t know if it is a better aproach than caching via Redis the data.

What I’d suggest is simply changing the variable to what you actually need. So I’d change it to

define('MEMBERSHIP_LEVELS', 11);

Then I think you will get a feel for whether that makes a difference. I’d also recommend you look into using OpCache, and also moving from MySQL to MariaDB.

Hello Tim,
as we already have several blogs with S2member pro 'since 2013), we know how to upgrade to pro and increasing the number of roles.
But this time, we can not.
Each time we add the

<?php define("MEMBERSHIP_LEVELS", 24); /** code in the wp.config file at the begining (properly), we obtain: Warning: Cannot modify header information - headers already sent by (output started at /homepages/16/d552909238/htdocs/no-angoisse/wp-config.php:1) in /homepages/16/d552909238/htdocs/no-angoisse/wp-admin/includes/misc.php on line 1124 Warning: Cannot modify header information - headers already sent by (output started at /homepages/16/d552909238/htdocs/no-angoisse/wp-config.php:1) in /homepages/16/d552909238/htdocs/no-angoisse/wp-includes/pluggable.php on line 1219 This, even - when other plugins deacticated - when S2member deactivated - after uninstalling S2member We can not even delete the define("MEMBERSHIP_LEVELS", 24); ligne code after that, we have to upload wp.config again. Can you help ?

Since we can not obtain any answer, we declare to be very desapointed with that buying.
We did not that a ticket would not be resolved with sharks.

That is not a “support ticket system”, but “community forum”. You can not demand answer. Or will not like what you will get as answer…

1 Like