Page 1 of 1

slow resource loads

PostPosted: August 5th, 2011, 1:49 pm
by s1r0n
OK. I'm busy optimizing my site and it turns out that s2member pro has some horrible resource load times. in particular

http://www.michaelsharp.org/?ws_plugin_ ... 3437706220

and

http://www.michaelsharp.org/?ws_plugin_ ... 3437706220

show horribly sucky load times. just about TEN TIMES slower than any other CSS or JS on the site.

can somebody tell me how to fix this. this is the one site bottlekneck that is reducing my YSLOW and impacting my SEO

Re: slow resource loads

PostPosted: August 5th, 2011, 11:07 pm
by Cristián Lávaque
Have you tried a cache plugin like Quick Cache also by Jason? https://wordpress.org/extend/plugins/quick-cache/

There may be a conflict with another plugin that causes this problem. Do you get the same times for those files if you disabled the other plugins as a test?

Re: slow resource loads

PostPosted: August 6th, 2011, 4:46 pm
by s1r0n
i've tried taking all plugins out and I still get the same error.

Re: slow resource loads

PostPosted: August 6th, 2011, 4:59 pm
by s1r0n
look what I found

viewtopic.php?t=1492

seems to be a known issue.

this really needs to be addressed. i am NOT on a shared host. have a VPS. and these little downloads reduce my site from one that loads very fast, to one that performs little better than on a poor shared host

Re: slow resource loads

PostPosted: August 8th, 2011, 9:14 am
by s1r0n
come on guys. there must be a solution to this. is is feasible to just stop loading these files. what will that do to the display of the PRO forms. better question, why are CSS and JS files that seem to be required just on forms pages being loaded on every page. this is a major concern and a major problem on my site

Re: slow resource loads

PostPosted: August 8th, 2011, 10:53 am
by drbyte
use custom include headers in your theme.

Re: slow resource loads

PostPosted: August 8th, 2011, 11:15 am
by s1r0n
drbyte wrote:use custom include headers in your theme.


Thank you Dr. unfortunately, that's a bit too vague for me. should I

1) remove the offending actions
2) use custom include headers (whatever they are) to include JS and CSS only on the forms pages and

if so

how?

m

Re: slow resource loads

PostPosted: August 8th, 2011, 12:46 pm
by s1r0n
i tried removing the offending actions, but the error still occurs.

so just to be clear, i remove all plugins and the site loads fast. I add back JUST the s2 plugin, and the site crawls. removing the actions as suggested in the other thread doesn't help at all. I still get this

http://subscriber.thelightningpath.com/ ... 2169816587

URL loading very slow. i'm very concerned. i can't continue to use this plug with this performance hit. literally makes my site between 10 and 20 times slower than it should be

Re: slow resource loads

PostPosted: August 8th, 2011, 2:03 pm
by s1r0n
i'm also getting other weird things. when I have the plugins enabled I get an xmlrpc.php x-header that is incorrect. well it is sorta correct. it points to ome of the sites in my wordpress installation, but not the current one. this is giving me a headache.

Re: slow resource loads

PostPosted: August 8th, 2011, 4:08 pm
by Cristián Lávaque
We're working with Jason on a way to make those files load faster.

I don't know what trouble removing the JS include would cause in most pages, it probably wouldn't be much problem as long as it's a page where s2Member doesn't use JS (e.g. not a pro-form), so you could include it selectively.

You can remove CSS and use your own without a problem, though.

How can I prevent s2Member Pro from loading it's default CSS?

You can create this directory and file: /wp-content/mu-plugins/s2-hacks.php

Code: Select all
<?php
add_action 
("ws_plugin__s2member_after_loaded", "remove_s2_pro_css");
function remove_s2_pro_css ()
    {
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_css_js::css");
    }
?>


Or, you could remove only specific action Hooks; based on Payment Gateway.

Code: Select all
<?php
add_action 
("ws_plugin__s2member_after_loaded", "remove_s2_pro_css");
function remove_s2_pro_css ()
    {
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_alipay_css_js::alipay_css");
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_authnet_css_js::authnet_css");
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_ccbill_css_js::ccbill_css");
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_clickbank_css_js::clickbank_css");
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_google_css_js::google_css");
        remove_action ("ws_plugin__s2member_during_css", "c_ws_plugin__s2member_pro_paypal_css_js::paypal_css");
    }
?>

Re: slow resource loads

PostPosted: August 8th, 2011, 4:55 pm
by s1r0n
ya I tried that. it messes up the pro forms though beyond recognition. personally I think those css and js files should be loaded ONLY where the forums are loaded. they are a waste of bandwidth on 98 percent of my pages

m

Re: slow resource loads

PostPosted: August 8th, 2011, 5:02 pm
by s1r0n
also, i notice that minfy isn't picking up on them. so maybe you need to investigate wordpress methods for including CSS and JS. thisway on sites like mine that use minify they can be concatenated along with all the other plugin css and js files

Re: slow resource loads

PostPosted: August 8th, 2011, 5:16 pm
by Cristián Lávaque
Thanks. I'll show that to Jason.

Re: slow resource loads

PostPosted: August 8th, 2011, 10:01 pm
by drbyte
Hi Guys..sorry for the delays..I had to get some sleep.

s1r0n...are you on a Windows Box? What's the server configurations?

If you are getting huge amount of traffic then you need to reduce the amount of plugins you use on the site. They must be hand coded into your theme. WordPress as is a heavy script adding 15 or 20 scripts on top makes it a NONO script to run on shared hosting servers. Moving to a VPS box is one way to avoid suspension but with that you are still sharing your site with 5 or 6 accounts...one of then can be a very heavy traffic site and can take all the juice the server has to offer. So really a VPS box can be slow too.

Having said that, some themes are poorly written and can run extremely bad with other scripts. Most common issue is looping. I suggest checking your error log and find out of any is maxing the server memory. (exhausting the server memory).

I also did tell you about including different headers in your theme!! Well for that you have to study your theme really good and know what loads into each page.

NOTE: there are so many different methods to achieve this.


By default all plugins uses <?php get_header(); ?> to insert whatever they need for it to work. they use other tags too...in the page.php, footer.php and so forth.

You can use <?php include (TEMPLATEPATH . '/header-home.php'); ?> on your home or index page instead of <?php get_header(); ?>. You have to create header-home.php first

In the header-home.php you can add whatever you want (js, css, and so forth) to make your theme functional (menu, flash). That's why I said you need to study your theme first. Off course none of the plugins will be functional unless you want them to. (hand code the plugin JS, CSS) into the header-home.php.

You can leave the rest of the theme pages to load the default header.php or you can customize each page to load different header and footer.

Let's say you don't need any of the plugins to be loaded into your home, contact us, about us, info pages..just use the customized header and none of the plugin will load. So you have clean fast pages. (You still need to use WP loop)
Code: Select all
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(''); ?>
<?php endwhile; else: ?>
<?php endif; ?>


Or you can search Google of how to use content outside the loop

The most important pages I think S2m are (signup page, login page, welcome) or any page that requires S2m to work, like the Pro forms in pages. (s2m setup)

Having said that, there are some scripts that you can use in your function.php to stop certain plugins from loading in certain page) Google it and you will find bunch.

Others:

You can hide anything you want in certain pages by using this:
Code: Select all
<?php if( !is_page(array('pageID', 'pageID')) ) :?>
Any code you don't want to show on the above pages goes in here. I use that to hide some parts of the header like menus, use logo with no link back....
<?php } ?>
<?php endif;?>


I would first check the error log and then move toward other solutions.

Sam

Re: slow resource loads

PostPosted: August 26th, 2011, 3:34 am
by ktkfo4
Loading times of S2member are just HORRIBLE. The css and js calls slow down the site by SECONDS. This makes visitors jump off!

The fix "you can create this directory and file: /wp-content/mu-plugins/s2-hacks.php ..." does not work, must be something missing.

This is really a massive problem - I don't want to have a site that takes 5 seconds to load just because of S2member!

Re: slow resource loads

PostPosted: August 26th, 2011, 4:42 am
by ktkfo4
OK, as nobody came up with a good solution to a simple problem for 3 weeks, I've looked around myself and found this plugin:

http://wordpress.org/extend/plugins/plugin-organizer/

It lets you exclude certain plugins from certain pages and posts.

Excluding s2member from my home page and the marketing relevant pages reduced my site's loading times by 3 (! three !) seconds at least.

This is no caching issue. And it's no hosting issue. You can tell from pagespeed and network statistics it's s2member's css and js call that takes awfully long to proceed.

I do really hope that the s2member team will address their performance problems - 5 seconds site loading time because of 2 tiny css/js files are an absolute NO GO for any ambitious membership site!!!

Re: slow resource loads

PostPosted: August 26th, 2011, 11:13 pm
by Cristián Lávaque
You're right, we have to improve that. We're working on it. Thank you very much for your comments, I've forwarded them to Jason. :)

Re: slow resource loads

PostPosted: August 29th, 2011, 6:50 pm
by s1r0n
ya an improvement would be MUCH appreciated. its actually causing me to purchase extra CPU power, unnecessarily.

this can't be a difficult fix. how hard can it be to load a javascript and css file efficiently?

Re: slow resource loads

PostPosted: August 30th, 2011, 7:08 pm
by Jason Caldwell
While we ARE working to further optimize this, I feel I should clarify this issue a bit further, so that some of you can understand what is actually the problem.

This lag discussed here, which some are reporting, is not directly attributed to any of s2Member's routines by themselves. In fact, the PHP routines responsible for loading s2Member's JavaScript and CSS files dynamically, are already highly optimized through PHP and WordPress Hook priority.

The reason some of you are having trouble, and working with debugging tools like Firebug, is because s2Member loads its JavaScript and CSS dynamically through WordPress. Therefore, if your WordPress installation has MANY plugins, or is otherwise slow for one reason or another, it can appear that s2Member itself is lagging, because your WordPress installation is slow to respond overall. For instance, you might have 20+ plugins, and if one of them is causing a bottleneck, that can greatly magnify this issue. Thus, the need for us to improve upon this, but also, for you to fully understand the problem may help you further optimize your site; so that perhaps this won't be such a problem for you, even now.

Let's take a look at an example:
If I go to your WordPress site and you have 20+ plugins running on a below-average server, I may have a response time of say 3 seconds, whereby it takes WordPress ( on a particular server, with a particular plugin combination ), about 3 seconds to load up and initialize, and then a few more seconds to actually load the page. Important here, is that it took your site a full 3 seconds just to initialize ( for whatever reason, usually attributed to slow plugins ), and it really should take FAR less than that. s2Member is highly optimized in various ways, not the least of which is through SPL autoload functionality, which makes it VERY fast; so I seriously doubt s2Member is attributing to initialization issues; no, that's more likely to be attributed to other plugins, or to the combination of certain plugins that together create bottlenecks and initialization issues. It just depends on what you're doing really. Sometimes it's just slow because of too many plugins running at once ( i.e too much code trying to power one site ).

Now, keeping in mind that your WordPress installation initially took 3 seconds to initialize, if I then have to load s2Member's JavaScript and CSS files through this same slow framework configuration, I will have at least another 3 seconds for each ( 6 seconds combined ), of lag time added to an already slow site. So this magnifies the problem for some of you, because s2Member's JavaScript and CSS files are being loaded on a site that is already slow, and adding two additional connections to this slow-moving framework configuration just makes things worse.

The solution, to load s2Member's JavaScript and CSS files statically, so they're not dependent upon a potentially slow framework configuration. Unfortunately, this is taking time for us to make possible. There are many parts of s2Member that are dependent upon the WordPress framework, and we're working to separate those in order to further optimize things. We're getting closer on this, hopefully we'll be ready in the next release or two.

But, while we work to improve this, may I suggest that you take this information, and make further attempts to optimize your site overall. The load time that you see on s2Member's JavaScript and CSS files is about 99% related to your WordPress initialization time, and only about 1% related to s2Member itself. It's true, we need to help you work around this issue by loading s2Memer's JavaScript and CSS statically, instead of dynamicallly, but that's not going to change the initialization time of your site overall. So, it won't hurt to look closer at your initialization time while we continue to work on this. I hope this information helps you. If not, you may want to consider hiring a freelancer to do a full review of your site. Given this information, they can work to eliminate and/or optimize parts of your site, and speed up your initialization time, making your framework configuration load faster overall. On sites that are highly optimized, adding an additional say.. 0.2 seconds for each of s2Member's JavaScript/CSS files is definitely not going to disrupt your visitor's experience nearly as much.

Re: slow resource loads

PostPosted: August 31st, 2011, 10:09 am
by s1r0n
the problem with your explanation is that a) it still lags even when I take out all the plugins and b) i'm not on a below average server. i think i posted that I tried it with no plugins almost as soon as I noticed the problem.

i think one of the problems is the URL of those resource loads dont' cache because of the datestamp (or whatever) added on at the tail.

Re: slow resource loads

PostPosted: August 31st, 2011, 12:57 pm
by Jason Caldwell
Thanks for the reply. Can I get a link to your site please, I'd like to examine it in Firebug. If you'd rather send it privately, please use this contact form: http://www.s2member.com/contact/

Re: slow resource loads

PostPosted: September 2nd, 2011, 9:29 am
by s1r0n
well you know what, I'm thinking I'm going to have to eat my words on this one. I dont' know what I did but I can't seem to get the slow resource load times anymore. it's all loading pretty quickly now. I suspect I probably swapped out a plugin or did something to the site to improve it and now everything looks kosher.

oops (blushing, red faced, turns away coughing)

m

Re: slow resource loads

PostPosted: September 2nd, 2011, 8:24 pm
by Cristián Lávaque
Great to know your page is quicker now. Thanks for the update! :)

Re: slow resource loads

PostPosted: December 19th, 2011, 7:34 pm
by Temple
Cristián Lávaque wrote:Have you tried a cache plugin like Quick Cache also by Jason? https://wordpress.org/extend/plugins/quick-cache/

There may be a conflict with another plugin that causes this problem. Do you get the same times for those files if you disabled the other plugins as a test?

Thank you very much for this plugin! This has really helped me to dramatically reduce my sites load time. I have been having issues with this ever since I switched to my new server. I was thinking about switching again to Cloud Hosting, but I am not sure. Has anyone ever tried them before? Do you think it would be a good move for me? How reliable are they? If I decide to go with them, I will need to make sure that it is not something I will regret later. Thank you very much!

Re: slow resource loads

PostPosted: February 6th, 2012, 1:24 pm
by Jason Caldwell
This JavaScript/CSS issues discussed earlier in this thread were resolved in the release of s2Member v111220, which now supports what we refer to as /s2member-o.php, where only the s2Member plugin is loaded to serve dynamic JavaScript/CSS. Further improvements will come in a future release.