latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

User Limit

Home Forums Community Forum User Limit

Tagged: 

This topic contains 5 replies, has 2 voices. Last updated by  Jason (Lead Developer) 4 years, 11 months ago.

Topic Author Topic
Posted: Monday Feb 6th, 2012 at 2:51 pm #4096
Mo
Username: boldplans

I have quoted the reply below. I have over 40,000 users on my site and am using WordPress 3.3.1 and not an old version. I still get timeouts and can’t turn on the plugin.

http://www.primothemes.com/forums/viewtopic.php?f=4&t=16997&p=62326#p62326

This query you reported looks like it comes from an older version of WordPress? Starting with WordPress v3.1, this was deprecated in favor of WP_User_Query.

Please confirm which version of WordPress that you were running.

If it was prior to WordPress v3.1, I would highly recommend that you upgrade. There were several improvements in v3.1 in this respect, making WordPress a more solid choice for a large userbase.

Each site is unique, but I can tell you that I’ve seen WordPress/s2Member power sites with as many as 30K users. Beyond that you will likely need a database and object cache, along with lots of RAM. Of course, much of this depends on how active your users are, and on what other plugins you’re running.

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Tuesday Feb 7th, 2012 at 1:16 pm #4380
Staff Member

Hi there. Thanks for the follow-up.

The slow query that you referenced is no longer a part of the WordPress core, and it’s also not something that current versions of s2Member need to call upon any longer.

So, I suspect that you have another plugin or theme which is making a call that depends upon the old WP_User_Search class, which is now deprecated in WordPress v3.1+.

I would try searching your plugin/theme files for references to:

WP_User_Search
or ...1=1 

Does that return any results?

Posted: Tuesday Feb 7th, 2012 at 10:02 pm #4411
Mo
Username: boldplans

Jason – thanks for the reply. I turned off all plugins on my test site and turned on S2M in the network control panel for 6 sites (multisite). Here’s what happened with about 40k members – I tried it twice, one with a couple of popular plugins that are updated and pro and the second time

Wordpress admin panel: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 80 bytes) in /home/mysiteacct/public_html/wp-includes/meta.php on line 567

[Tue Feb 07 21:54:07 2012] [error] [client 111.222.333.444] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 80 bytes) in /home/mysiteacct/public_html/wp-includes/meta.php on line 567, referer: http://mysite.com/wp-admin/network/plugins.php
[Tue Feb 07 21:52:17 2012] [error] [client 111.222.333.444] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes) in /home/mysiteacct/public_html/wp-includes/meta.php on line 570, referer: http://mysite.com/wp-admin/network/plugins.php?error=true&plugin=s2member%2Fs2member.php&_error_nonce=d3da04cf9f
[Tue Feb 07 21:52:16 2012] [error] [client 111.222.333.444] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /home/mysiteacct/public_html/wp-includes/meta.php on line 567, referer: http://mysite.com/wp-admin/network/plugins.php?error=true&plugin=s2member%2Fs2member.php&_error_nonce=d3da04cf9f
[Tue Feb 07 21:51:16 2012] [error] [client 111.222.333.444] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 32 bytes) in /home/mysiteacct/public_html/wp-includes/meta.php on line 559, referer: http://mysite.com/wp-admin/network/plugins.php
Posted: Wednesday Feb 8th, 2012 at 1:12 am #4417
Mo
Username: boldplans

One other question — if we cannot get S2Member to turn on – and it might not be practical – is there a way to completely deinstall all the entries in the usersmeta table? I took a look and, IMHO, WP might be a bit disastrous when it comes to database management of users. In order to do a lookup on 30-40k users, it would have to search through hundreds of thousands of usersmeta entries and then join it to a userid in the users table. I don’t know why user metadata isn’t just added on as fields in the users table. As such, perhaps I should just use S2M on our smaller communities and clean out all those extra entries.

If you think we can get this to work, I’d still be open to the idea but probably should have the above backup plan as well. Thanks again for the great support. It really is a fantastic plugin.

Posted: Wednesday Feb 8th, 2012 at 6:24 am #4441
Staff Member

Thanks for the follow-up.

Ah, Multisite. With that many accounts, there might be a problem here in the s2Member activation routine, which is specific to Multisite installs. s2Member will try to update the Originating Blog ID for any existing accounts upon activation, which is not desirable with that many accounts (i.e. this needs to be further optimized by s2Member).

If you open this file:
/plugins/s2member/includes/classes/installation.inc.php

At line #121 look for this section please:

if (is_multisite () && is_main_site ())
{
foreach ((array)($users = $wpdb->get_results ("SELECT `ID` FROM `" . $wpdb->users . "`")) as $user)
	if (!($originating_blog = get_user_meta ($user->ID, "s2member_originating_blog", true)))
		update_user_meta ($user->ID, "s2member_originating_blog", $current_site->blog_id);

Replace with the following for optimization:

if (is_multisite() && is_main_site())
{
	$wpdb->query("INSERT INTO `".$wpdb->usermeta."` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 's2member_originating_blog', '".esc_sql($current_site->blog_id)."' FROM `".$wpdb->users."` WHERE `ID` NOT IN (SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE `meta_key` = 's2member_originating_blog')");

I’ll have this updated in next maintenance release.

Posted: Wednesday Feb 8th, 2012 at 6:35 am #4443
Staff Member

I don’t know why user metadata isn’t just added on as fields in the users table. As such, perhaps I should just use S2M on our smaller communities and clean out all those extra entries.

I think if each of us designed our own software application we would NOT do it this way (i.e. with the wp_usermeta table being used for so many things). However, as a “framework”, WordPress uses the wp_usermeta table to allow plugins/themes to extend WordPress in creative ways without damaging or modifying the underlying table structure that powers a site (e.g. which might lead to even worse situations and/or mass confusion).

So while the wp_usermeta table is not ideal for every application, it’s a middle ground between usability, performance, extensibility. I would stick with WordPress a bit longer and see if you can iron out some of these optimization issues. Any time you’re running a site with that many users, there are bound to be some issues like this that need to be tweaked, and WordPress is no different.

Please take my previous post as one example. Anything that relies heavily upon get_user_meta(), update_user_meta(), get_user_option(), update_user_option() in looping routines, should be avoided if at all possible; in favor of direct database calls.

If you’re seeing memory limits on functions inside /wp-includes/meta.php, they are most likely related to the internal cache associated with User meta entries, as a result of calling one of these functions.

I’m not aware of any other issues like this within s2Member, but if you run into any other problems, please let us know and we’ll help you work through them.

Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.