Facebook like on posts and blog

We have a site at http://www.themoneyprinciple.co.uk which is rather slow to load. It is on quite a skinny server at the moment but the main problem is both the size and response of Facebook. I realise that some minify is needed and other things. The theme was originally based on Artisteer but has been extensively modified. Feel free to look at the source but you will see what I mean.

There are individual FB like buttons on each post from the "Really simple Facebook and Twitter share buttons" and also a Fanpage box which shows pix of the fans. When I disabled this plugin on a development the download went down by a factor of about 3!

Analysing what is downloaded, each Like button is 24kB and the .css and .js alone for the Fanpage box (which is in an iframe of course) is quite large. Note I am not using FB login or connection or anything. I just want readers to be able to Like individual posts (and hence get them published on their pages) or join the MoneyPrinciple fanpage. By comparison, Twitter is lightness itself (but of course does rather less work).

I see that WPMU has the same box and Like button but is a lot faster. This may be because you are using a much bigger server or nginx (as you are) but then we do not have many sites on my server nor that many visitors. I also see that you are using Comments Plus but other than that how do you minimise the FB download time? It is a real irritation and is affecting our ranking I think.

  • Timothy Bowers

    Hey Loggy.

    Can I be sure you are using our Ultimate FB plugin, or is it another one?

    As you note we don't have loads of buttons from FB on every page. But every query is obviously going to increase the load. Not only external queries to third party sites but also internal queries from other plugins and even themes.

    You could look at something like W3 Cache or WP Super Cache. That should help you with some of the load times.

    Even plugins not conflicting still impose load on your site and server, they can change the load sequence in which something is called.

    I see you say MoneyPrinciple: http://www.themoneyprinciple.co.uk/

    Seems pretty quick to me, I don't see a major issue with load times?

    Thanks.

  • aecnu

    Greetings Loggy :slight_smile:

    after checking out your site and running the recommended by Google speed testing (Page Speed) you have an aggregate score of 89 out of 100 - not bad at all.

    [Score: 43/100]

    ?Leverage browser caching

    [Score: 81/100]

    ?Serve resources from a consistent URL

    [Score: 67/100]

    ?Combine images into CSS sprites

    These above are where you are hurting in speed as shown above.

    However, what you are seeing and what you perceive to be slow speeds could be related to so many things from slow server, shared server with cpu throttling for each site, bandwidth, server attacks from not having a firewall etc, etc. the possibilities are many.

    If you have a Dedicated Server I recommend doing gzip/deflate, zlib compression, expires mod, and some kind of browser caching to pick up most of the missing points.

    Joe :slight_smile:

  • Loggy

    @timothy - I am currently using Really simple FB and Twitter which puts the like buttons on each page etc (you can configuer this). I was aware of UFB but people seem to have a bit of difficulty with that one - no doubt they overcome it! But the question was really how to optimise things. I am using WP Super Cache anyway. The fanpage box is just copied from FB - no plugin although it has be to copied onto varous pages!

    @Joe - interesting test which is a bit reassuring. It is running on a very skinny KVM VPS that I configure and run - Ubuntu 10.04 LTS in fact. Only 1GB of ram and 500MHz but in my experience this shouldn't be too much of a problem. Apache is restarted every night because otherwise it seems to grow! The firewall is fine (only a few ports open, tiger and other security things running, cut down permissions all over the place - directories 2751, files 640 some g+w where necessary, tree in group www-data etc etc.) gzip and zlib are enabled but they aren't implemented in delivering pages (enabled in cURL according to phpinfo...).

    A possible problem is that because I have the number of threads cut down so if it runs out, it actually has to start a thread. Otherwise it will run out of memory - it has on occasions and dies! The server is still in development - I will increase the poke when needed but these things cost money and I would rather have a system that is lean and fit than just throw loads of money and power at it only to find it runs out of steam anyway IYSWIM. Hence my interest in nginx

  • aecnu

    Greetings Loggy :slight_smile:

    we have it implemented as part of the httpd.conf file, if running WP Super Cache I wonder why you are getting very low score for Leverage browser caching?

    When referring to the firewall and your mentioning that apache seems to grow indicates that it may be attacks on port 80 trying to compromise both the signup and comments sections - which is inherent to WordPress - as a matter of fact many IP's are burned as Dictionary Attackers for just this sort of thing.

    http://www.projecthoneypot.org/list_of_ips.php?t=d

    with all that said I believe Tim and I have more then suffciently fulfilled the purpose of this ticket and I am going to mark it resolved :slight_smile:

    Joe :slight_smile:

  • Loggy

    @Joe

    I will check my cache settings - of course that doesn't work if I am logged in!

    I'm thinking of running all production sites on nginx on port 80 and moving development sites, which need .htaccess to lock off access with htpasswd, to apache in port 8080 or something. Then if I add the appropriate rewrite instructions into nginx I think the same redirects should work for all permalinks. But as wpmudev and wpmu both run nginx, presumably you mean you put the fb stuff into the nginx.conf?

    I have project honeypot aka bad behavior running on all my sites. I am pretty sure it is not attacks on port 80 that are causing the problem with apache. This is from the apache.conf:

    KeepAliveTimeout 2
    <IfModule mpm_prefork_module>
        StartServers          3
        MinSpareServers       3
        MaxSpareServers       8
        MaxClients            50
        MaxRequestsPerChild   2000
    </IfModule>
    <IfModule mpm_worker_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    <IfModule mpm_event_module>
        StartServers          2
        MaxClients          150
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxRequestsPerChild   0
    </IfModule>

    So you see that I am trying to keep the number of active and spare servers to a minimum. Comments welcome!

  • aecnu

    Greetings Loggy :slight_smile:

    Project Honey Pot does is more about mail servers then dictionary attackers.

    During some of the high end server loads just check some of the IP's in Google and you will see what I mean - there is another site that lists these kinds of attackers

    http://www.bizimbal.com/

    In addition I know of lots of folks that have trouble with nginx

    https://premium.wpmudev.org/forums/search.php?q=nginx

    MaxRequestsPerChild 2000

    I would personally set to 500 :slight_smile:

    Joe :slight_smile:

  • Loggy

    @Joe

    Thanks for that suggestion - I have lowered it now and we will see what happens. Bad Behavio(u)r does of course report when you get an attempted spam comment. Since March last year we have only had 740 and caught a few sploggers with my MX donation. I don't think that is the problem.

    I will follow the nginx issue although as WPMU and many others (including wordpress.com, facebook) use it, it must work. It may be little messy setting it up. One day WP will work natively with nginx. lighttpd etc. Or Apache will enable you to limit how many directories you need to check for an .htaccess - maybe in the vhost setup. Wordpress has quite a big directory tree and in principle .htaccess could be in any of them. The other advantage of other servers is the issue of Apache spawning processes all over the place, which is wasteful. Just checked your link - it could be an errant plugin that is stealing memory. I do get issues with Google Analytics Async - there is a mysql error generated in it. I can list all the plugins on all sites (and whether they are up-to-date) as well so I can check theat too.

    I've been trying to get caching working - it wasn't enabled. But even though I now have the modules in mods-enabled, ExpiresActive On set to 1 month for most things and UseCanonicalName On PageSpeed doesn't detect it! I've put these all in apache.conf rather than the vhost as I want it applied to all sites - it doesn't detect it in either! I have restarted apache of course!!!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.