Tips for improving performance with plugin heavy sites?

I had my site slow to a halt today when the memory footprint of PHP went crazy. So I've been checking out the impact of different plugins running, creating a spreadsheet to determine memory usage and page load times as I added each plugin in turn. I did this for the 30 main plugins I'm using.

There are another 20 or so smaller utility plugins I have still to activate, but before my memory usage goes crazy I'm wondering what tips anyone has to reduce their impact, for a Multisite network running Buddypress.

BuddyPress, bbPress, MarketPress, various media and social plugins have quite an impact. Would it make sense to only network activate those tools that are used across the whole network? Does this reduce the general footprint when browsing 'lighter' sites? Then just enable plugins in sites when needed (or upgraded to Pro)?

Or are plugins always in memory that are activated at least on one site on the server?

  • Imperative Ideas
    • HummingBird

    My opinions are mixed on caching software but a plugin like W3TC may help significantly by combining all of your scripts and assets. You probably knew that though.

    The main "tips" for a resource-heavy site are:

    + Cut down the number of requests you are making to the server.

    + Make sure your web host has allocated enough RAM to run your site. A place like Dreamhost will give you 64mb of RAM. A WP install at base is around 40 and floats up considerably as you extend functionality. If you pop their limit, you get hit really hard with the throttle-stick. Don't even think about running a second site on that account either because even if they let you register 25 domains, they're still only giving you enough raw power for one micro to small installation.

    + Serve static assets from a CDN, particularly if there are a lot of them

    + Run your PNG files through and the rest of your graphics files through

    + Add the following to your .htaccess file:

    # turn on the module for this directory
    ExpiresActive on
    # Set default expiration for site
    ExpiresDefault "access plus 1 months"
    # Set expiration for common graphical assets
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    # Set expiration for all applicatble script types
    ExpiresByType text/javascript "access plus 1 weeks"
    ExpiresByType application/javascript "access plus 1 weeks"
    ExpiresByType text/js "access plus 1 weeks"
    ExpiresByType application/js "access plus 1 weeks"
    ExpiresByType text/php "access plus 1 weeks"
    ExpiresByType text/css "access plus 1 weeks"
    ExpiresByType application/x-shockwave-flash "access plus 1 weeks"
    # Add a far future Expires header for fonts
    ExpiresByType application/ "access plus 1 year"
    ExpiresByType font/ttf "access plus 1 year"
    ExpiresByType font/otf "access plus 1 year"
    ExpiresByType font/x-woff "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    # Compress compressible fonts
    AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
    # Compress all js & css:
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-woff application/json
    Header append Vary Accept-Encoding
    #Turn on GZip compression if available
    <ifModule mod_gzip.c>
      mod_gzip_on Yes
      mod_gzip_dechunk Yes
      mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
      mod_gzip_item_include handler ^cgi-script$
      mod_gzip_item_include mime ^text/.*
      mod_gzip_item_include mime ^application/x-javascript.*
      mod_gzip_item_exclude mime ^image/.*
      mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    # Add correct content-type for fonts
    AddType application/ .eot
    AddType font/ttf .ttf
    AddType font/otf .otf
    AddType font/x-woff .woff
    AddType image/svg+xml .svg
    # Add correct content-type for all other objects
    <IfModule mod_mime.c>
        AddType text/css .css
        AddType application/x-javascript .js
        AddType text/html .html .htm
        AddType text/richtext .rtf .rtx
        AddType image/svg+xml .svg .svgz
        AddType text/plain .txt
        AddType text/xsd .xsd
        AddType text/xsl .xsl
        AddType text/xml .xml
        AddType video/asf .asf .asx .wax .wmv .wmx
        AddType video/avi .avi
        AddType image/bmp .bmp
        AddType application/java .class
        AddType video/divx .divx
        AddType application/msword .doc .docx
        AddType application/x-msdownload .exe
        AddType image/gif .gif
        AddType application/x-gzip .gz .gzip
        AddType image/x-icon .ico
        AddType image/jpeg .jpg .jpeg .jpe
        AddType application/ .mdb
        AddType audio/midi .mid .midi
        AddType video/quicktime .mov .qt
        AddType audio/mpeg .mp3 .m4a
        AddType video/mp4 .mp4 .m4v
        AddType video/mpeg .mpeg .mpg .mpe
        AddType application/ .mpp
        AddType application/vnd.oasis.opendocument.database .odb
        AddType application/vnd.oasis.opendocument.chart .odc
        AddType application/vnd.oasis.opendocument.formula .odf
        AddType application/ .odg
        AddType application/vnd.oasis.opendocument.presentation .odp
        AddType application/vnd.oasis.opendocument.spreadsheet .ods
        AddType application/vnd.oasis.opendocument.text .odt
        AddType audio/ogg .ogg
        AddType application/pdf .pdf
        AddType image/png .png
        AddType application/ .pot .pps .ppt .pptx
        AddType audio/x-realaudio .ra .ram
        AddType application/x-shockwave-flash .swf
        AddType application/x-tar .tar
        AddType image/tiff .tif .tiff
        AddType audio/wav .wav
        AddType audio/wma .wma
        AddType application/ .wri
        AddType application/ .xla .xls .xlsx .xlt .xlw
        AddType application/zip .zip

    But really, the biggest thing on the books should be ensuring your server has enough RAM to handle your site. That's always the first place I look to improve performance. You simply cannot run a serious site for $5/mo, no matter what GoDaddy tells you.

  • aecnu
    • WP Unicorn

    Greetings xootom and Ian,

    @ Ian - sure you can but just not on Go Daddy or almost any of the other hosting platforms out there for $5 - but I will put my money where my mouth is - I will let you test a $4 a month hosting account on my servers and then in exchange you tell about the performance. And dude is on Rack Space by the way and not Go Daddy.

    As many times as we have had the conversation about hosting to this day you have never stuck your $4 out there - so I am - let me know the domain and you point it to my servers and I bet a $4 hosting account rocks like you have never seen before and no charge for the test! Have a week or two on me!

    No CDN, No Caching and I bet you get nothing but pure performance. Are you in?

    @xootom we are indeed working what is almost a duplicate ticket right here:

    And I invite Ian to join us there if he would like and I look forward to showing him the proof is in the pudding ... lol

    Marking this ticket as resolved in lieu of the one described above.

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greetings Ian,

    Thank you sir. Look forward to it when you do choose to dig in, but yes that is one primary domain as you mentioned, but unlimited parked domains as well so one MultiSite can be constructed that has many domains and limited, of course, in full disclosure to the space available.

    No smoke and mirrors, just performance.

    Cheers, Joe

  • Techtomic
    • Techie

    Hi guys,

    Thank you so much for all your help, yes I will go back to the other thread and follow it from there.

    It's not really that I'm trying to get things running on the cheapest possible servers or anything like that. We're running on Rackspace Cloud Servers (seen as we've been using it for other projects, so I'm familiar with them and it's scalable while we test new platforms.)

    I guess I'm trying to work out the best bang for the buck based on some kind of logic wrt memory usage, number of processes, etc. Just for testing things with two or three users I'm running on a 512MB image, but will be happy to scale this up to whatever is necessary to ensure fair performance.

    But I want to get a handle on how to best configure nginx/php-fpm based on what the kind of memory footprint of all the plugins are, multiplied by number of processes (I guess that limits concurrent users accessing the site) to ensure not too many processes are running causing the server to start swapping.

    Will probably double it to 1GB when I get a few minutes to get it a bit more snappy. Then if php is using say 80MB each, I can fit 10 in memory with some room for overhead, mysql etc.

    My thoughts were, does having different sites running different plugins, on a multisite server, cause pages loaded on each site to only take up memory of plugins activated on that individual site? So hypothetically if I have 200 (!) plugins deactivated total, and different sites activate them in different combinations (say up to 20 plugins active per site), PHP will still only peak at the level of the 20 plugins, rather than 200? Does that make sense?

    @Imperative Ideas: Yes I tried P3 two or three times during my testing, hence my other thread thinking Ultimate Branding might be causing a big % slowdown relative to its simple features. P3 doesn't seem to profile memory usage, rather page load times, is there anything similar to break down plugins into memory usage?

    All the best,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.