× Joomla Facebook Connect support forum

Topic-icon Performance and Facebook Fan Page

Active Subscriptions:

None
11 years 9 months ago #25460 by bobmeetin
Can anything be done to improve the performance, page load speed, of pages where the Fan page is enabled, mod_jfbcfan? Between the http connections, the javascript and of course some images/data it can easily slow a page down by several seconds.
The topic has been locked.
Support Specialist
11 years 9 months ago #25461 by alzander
There really aren't any great things we can do on our end, and we've been noticing a bit more of a slowdown recently than normal as well. It's all loaded through an iFrame, which is created through Javascript. The best suggestion we can give, although not a great one, is to disable user faces/avatars. That alone is where a lot of the requests are made to load each avatar. Additionally, there's no way to tell Facebook how many avatars to load, so even if your Fan box only shows 1 row of faces (let's say 5 total), a lot more are loaded by Facebook 'in case' more rows (height) is selected. Again, not a great option, but you may want to test without them to see how that improves your speed.

On a side note though, the Javascript to load the Fan module doesn't begin executing until the full HTML has rendered and all Javascript is loaded. So, it shouldn't slow any other elements on your page down.. it should just take a while, itself, to load. Hope that makes sense. Again, not ideal as you want it to load fast.. and when it doesn't, it can make the overall page seem slow, even though nothing else should be...

As always, keep us posted on anything you find in case there's some magic setting or idea you come up with!
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 8 months ago #25697 by bobmeetin
And you thought I'd followed Columbus as he fell off the face of the earth. Tisk tisk.

I don't have all the stats in hand yet but I did some performance testing over the weekend. I need to do this several times to ensure 'relative' consistency. I do similar tests when I find new and interesting extensions that seem to impact performance.

To put this in perspective, I work at home and run with a conservative internet connection of 1.5Mb/sec, intentionally. It's easy to go with the fastest connection and work but it makes it far more difficult to be empathetic with the many in the audience who aren't so fortunate. I want to see average pain!

I use ySlow and Firebug to chart the stats and I clear cache after every instance to obtain relatively consistency. I do about 10 tests, note the low (fastest) and record the average. Something like that. I ran 3 tests,

1) Recorded results as is, everything enabled
2) Disabled show faces
3) Disable Facebook Fan page

The results were somewhat baffling as there was very little difference; I didn't really see any improvement with 2 or 3. So I went into ySlow and looked at javascript and still saw the Facebook connect stuff. I couldn't see why but then I remembered the plugins. the JFBConnect plugins. Disabling the plugins did make a difference, about 1.5 seconds, didn't solve world hunger but helped both in page weight, performance. Also I think losing those http connections allowed the page to finish rendering faster than the 1.5 seconds ySlow recorded.

So here's my request. On this site and others there are pages where Facebook is required and those where it is not needed. I've seen plugins created that can be enabled/disabled on a page by page basis through a selection list like modules. Is this something that you might consider as an RFE?

I know you love my ideas. Harumph!

And BTW, if I could figure out how to do similar with K2 and its stylesheet and other baggage, wouldn't the world be a better place?
The topic has been locked.
Support Specialist
11 years 8 months ago #25704 by alzander
Bob,
Good sleuthing, as always :) You didn't say what the time was before disabling the JFBCSystem plugin.. just that with it disabled, it was 1.5s. Curious to know what the rough times were for #1-3.

As to your main question, we always include the JFBConnect / Facebook Javascript on every page. The reason for that is consistency and ease of use. While it may not be used on every page, it's impossible for us to know that ahead of time. There are some Javascript features like Requests or even the custom Login With Facebook button (using your own image/text) that can be inserted on any page manually without JFBConnect's knowledge until the page loads. To keep that flexibility, we have to know that our stuff functions on every page as well. Some features, such as auto-logging in Facebook users, also requires that the Javascript be loaded on every page just so we know if the user is logged into Facebook.

Regarding performance, the Facebook Javascript itself should almost all be fully cacheable, so after the first load of it, on subsequent pages, the only time requires is your browser execution time. So, your tests for #1-3 above *may* be slow. Further navigation on any page of the site though, not just the test page, should show an overall improvement. This is outside of any https requests, which can never be cached.. which is why we focus on removing as many of those as possible.

With that said, what we do load, we try to be extremely conservative about it. Simply disabling the Auto-login feature of JFBConnect saves an https lookup, connection, and download (usually about .25-.5s per page). The auto-login work is also only done for guests, and even then, there are cases where we know to disable it.. so registered users never get hit by that slowdown.

Finally, for PHP/database performance, we're always trying to optimize and verify things. I believe by enabling the JFBCSystem plugin, you add a *max* of 8 queries per page. Most pages don't even have that many. There are even ways we're looking into decreasing that query count a bit as well.

Anyways, hope that explains a bit of the performance side that we're aware of and what we do to keep things speedy. Integrating with other networks will slow any site down, but we try to make that hit in performance as negligible as possible.

As always, feedback/thoughts/yelling welcome!
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 8 months ago #25739 by bobmeetin
You really want some actual stats? Well I'll be... Without identifying the site here goes.

Cacheing only comes into play once a viewer has found your site, typically the home page, not always. If their first impression is that it is dog-tracking slow, then they may disappear before visiting other pages.

Internet connection is done through Skybeam and speed is advertised as 1.5MB/Second. A real Joe Average connection speed.
I do a set of 10 page reloads, each after clearing cache, then divide to get the average and I usually do this several times over several different days. YSlow is used to record load times and bytes.

With all enabled the site loads in 10.01 seconds. With JFBC Plugins disable it loads in 8.65 seconds, so a difference of 1.36 seconds. I did not disable fan page; I assumed that the gain would be negligible at that point. I think that because of the way the Facebook stuff loads it gives the feeling that it is much longer.

Just to see, I subsequently disable a slideshow, content slider next and got the load time down to 6.75 seconds. At 1.9 seconds that is a bigger gain that disabling JFBConnect/Facebook, but they all add up. We are looking to replace it with something thriftier shortly.

All that being said, I'd still like to see the ability to enable/disable plugins (in general) on an as needed basis, page by page. I've done a little programming with AJAX, wish I knew more, but in my mind I have this idea that you incorporate AJAX into some of these functions, say you display a Facebook login button, but only when you click on it does it initiate a connection. I don't know.

If I knew the template structure well enough I could modestly hack the template to accomplish some of this. You may disagree, but I see no reason to load K2 CSS (45K) on pages where it's not needed.

YouTube and services that offer easy access to embed code can get really ugly in how much JavaScript in addition to the http connections they bring in as baggage, thus I look at options to get around this as much as possible.

Over.
The topic has been locked.
Support Specialist
11 years 8 months ago #25740 by alzander
Understand what you're saying. A couple of notes:
1) With a load time like that, where is most of the 'load' coming from? Is it the connection time to your site, or the downloading of resources? One great thing to check is turning on the Joomla Debug features and seeing how long the server processing side is taking. If that's above 2s (or even really 1s), that's bad. Either too slow of a server, too many extensions, or just one or two sloppy extensions. A lot of time the speed slowdown isn't as much the connection or transfer of files as it is the site generating the page.
2) Turning on System - Cache (when Global Config cache is on as well) is a great way to determine the server impact as well. Even if you don't want to use the System - Cache (there are issues with it), just seeing the improvement may be a good frame of reference.
3) Things like JCH Optimize (what we use) or any of the other various compresses *can* help a lot. They also *can* hurt a lot if your server is slow (the extra horsepower can actually cause a slow down) or if they aren't optimized well to use caching, etc.
4) Try Pingdom as well. It's a 3rd party loader that may be useful is finding slowdowns (and free!). If you see long yellow bars, that's the sign that it's the server taking too long to actually create the page.

With all that said, the only real caveat I see with your test is that it's the worst, worst, worst case scenario. Mainly, things like the Facebook Javascript library may already be cached for the user simply by visiting other websites. Clearing your browser cache would get ride of a lot of the optimizations that browsers take advantage of, and shared resources like the FB JS, Google Analytics JS (assuming you have it) or other 3rd party Javascript are then being loaded 'fresh' on your page. That will slow any site down more than the average since at least some of that code would have been loaded on the users browser before hitting your page.

I'll have to think about ways to auto-load our Javascript as needed. It's really something we haven't considered and doing it through AJAX will cause a big hit after the user clicks the login button or if you are using a Fan module. If you think the Fan module is slower now, it'd be much worse after an AJAX cause because the full page would have to load, our AJAX would have to fire (another roundtrip to the server), the FB JS library would then have to be loaded and initialized and *then* the Fan box would start loading...

Hope that makes sense. Obviously, I'm shying away from that idea. Hopefully, we can find much lower hanging fruit to pluck off the speed tree :D

Alex
The topic has been locked.
Active Subscriptions:

None
11 years 8 months ago #25812 by bobmeetin
Okay... Do we get paid enough to do this on our time?

The server - I recently upgraded the server (Hostgator) from VPS level 4 to Level 5 to support a Magento install. It should be fine. I have a pingdom account and don't see any feather rufflers.

Apples to apples - I'm doing this on conservative 1.5 bps speed. What are you running with?
Worst case scenario, or is that worst worst worst? I can live with that. So there is the assumption that many of the folks who visit the internet have a lot of this stuff cached. What about those who don't? I read a stat the other day that around 50% of Americans over 12 are now on Facebook. Even though the other 50% aren't, will it still be cached?

When shopping for a car and looking at the fuel economy ratings I go with the city economy figures.

I made a couple config changes and ran some additional tests last night. I found j1.5 versions of CSS-JS-Compress and JCH-Optimize. I installed and tested CSS-JS but saw major page render flaws when combining CSS and very little gain. With JCH I also saw page render problems with CSS, so disabled it but did the JS combine and zip stuff and it worked better. I do see some modest page speed gains, but I haven't charted this yet.

I'm sure that once we replace the homepage slideshow things will improve. When I use ySlow to view the components I do see less components and less http requests., so this is good.

The image - this represents much of the problem. I ran this test a bunch of times last night turning faces on/off and turning the fan page on/off. I see real intermittent facebook stuff. The page weight would intermittently vary from about 950KB to 1600KB. Those extra 650 KB and time are all coming from Facebook.

You get this long list of js stuff like: static.ak.fbcdn.net/rsrc.php/..........

Turning fan page on/off seems to have no effect on the list, only turning of JFBConnect plugins does. This is a major part of the problem.

File Attachment:


You asked about enabling joomla debug. This is what I get on the slow, home page. On simpler inner pages, after Render is under 1 second.

Profile Information
Application afterLoad: 0.001 seconds, 0.39 MB
Application afterInitialise: 0.246 seconds, 10.39 MB
Application afterRoute: 0.465 seconds, 13.47 MB
Application afterDispatch: 0.581 seconds, 17.21 MB
Application afterRender: 1.115 seconds, 28.75 MB
Memory Usage
30365832
65 queries logged

In the ySlow report I do see some perhaps extraneous mootools and jquery stuff. I'll need to go on a witch hunt to see what if any can be disabled without causing calamity.

Over...
The topic has been locked.
Active Subscriptions:

None
11 years 8 months ago #25826 by bobmeetin
Last night I enabled PHP 3.1.5 on the server for the test site. Surprisingly, this made a small difference, roughly 10% improvement in page load speed.

Also, I got turned onto a site where you can test pages at different connection speeds: www.webpagetest.org/ . This helps me to see how those privileged folks live. Seriously, it is incredibly useful.

Regardless, I still intermittently see an accumulation of those weird javascript rsrc.php requests/things in the ySlow output. They seem to be at the heart of the problem when they pop up.
The topic has been locked.
Active Subscriptions:

None
11 years 8 months ago #26107 by bobmeetin
Hey there, just making my rounds. I realized that I still don't have an understanding of what is causing those rsrc.php requests which I captured in an images a couple posts back. Stuff like: static.ak.fbcdn.net/rsrc.php/....... This stuff comes and goes and when it's there it really slows stuff down.
The topic has been locked.
Support Specialist
11 years 8 months ago #26114 by alzander
Bob,
Sorry for the delay. I actually had your post on one of my lists to definitely get back to today.

Caching

Apples to apples - I'm doing this on conservative 1.5 bps speed. What are you running with?
Worst case scenario, or is that worst worst worst? I can live with that. So there is the assumption that many of the folks who visit the internet have a lot of this stuff cached. What about those who don't? I read a stat the other day that around 50% of Americans over 12 are now on Facebook. Even though the other 50% aren't, will it still be cached?

We're on a Time Warner 8Mbs download connect, which of course never hits that. Regardless though, I haven't seen the page you're working with, so I haven't even tried to load it :)

For the worst case scenario I mentioned, that is the absolute worst case. Something like 90%+ of sites have Google Analytics installed. I'm guessing that at least 25% (likely more depending on your users preferences) will have Facebook's Javascript. If so, that means when the user visits your page, that will already be loaded. Heck, you can try your same test, with one change.. close browser, clear all caches, visit sourcecoast.com and then your page. We load FB and Google Javascript, so that the visit to your site won't have to. The caching is all if a user visits a site that loads the same libraries that your site does, regardless of whether the user uses Google or Facebook.

Compressors
Yup, compressors can wreak all sorts of havoc with Javascript and CSS files. It can take a while to get the right combination of exclusions, ordering, and other things. The benefits are generally worth it (in my opinion), but it can be a pain. Less requests is always good. And that scales exponentially... if you get hit with a lot of traffic, each user will request less, meaning your site has a better chance to keep up. On 'slow' sites, the difference is less dramatic as your server better be able to handle a few connections at a time.

Rsrc.php
This file is Facebook's remote source inclusion script. Basically, when a page loads, they call this script dynamically depending on any other scripts, images, or CSS they need to pull into the page. So, while it looks like it may be duplicates, each request is for different 'stuff'. The more widgets you load on the page, the more calls you'll get to that script. If you check our home page , you'll see that there are (I think) no calls to rsync because we don't have any Facebook widgets there (like, fanbox, etc). If you do it to the JFBConnect home page . So, removing extra widgets, or minimizing the features (no avatars, etc) of some of the widgets can help decrease the calls and extra inclusions that Facebook has to make. If you can post, or PM, the page you're working with, I may be able to help narrow down where the extra inclusions are coming from.

I'd really recommend disabling the JFBCContent and any modules/{JFBCxx} tags you have on your page to see if the rsrc.php inclusions go away. If so, add incrementally and see what makes them explode.

Debug
The .5s between afterDispatch and afterRender is indicative of plugins or modules bogging down PHP and taking a while to render. System - Cache can help (since the page doesn't have to re-render every time, or you can try disabling plugins/modules and see where you get speedups.. though, of course, at the risk of loosing functionality. The component on that page is only taking ~100ms to execute (onAfterRoute -> onAfterDispatch), so that's good.

PHP Version
You mention enabling PHP 3.1.5. You have some numbers transposed there, so I don't know what you're actually using. 5.3.x is definitely faster than 5.2, which was faster than 5.1 though. So, the higher, usually, the better.. though Joomla has some issues with PHP 5.4, just so you know.

Hope that explains a bunch of stuff. Best of luck,
Alex
The topic has been locked.