The Elgg Community: Compactor [2.1.5]

http://community.elgg.org/pg/plugins/buggedcom/read/11560/compactor-215

!!IMPORTANT!!

Some of Elggs core plugins don't function properly due to the fact that their page handler functions aren't returning the correct values. For a list of patches please read this document. If anyone else finds a plugin that is conflicting with Compactor please let me know and I'll update the list.

What Am I?

The compactor does several things, mostly it just applies YSlow's recommendations to any outputted content. It caches css, javascript and dynamic images (gif, jpeg and pngs). Each cached item means it doesn't have to be regenerated freeing up a lot of resources. At the moment because each file is cached based on "md5($_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'])" the caching is permanent until the cache directory is cleared (automatically in hourly, weekly, monthly intervals etc).

It doesn't just free up server resources with the caching but also speeds up delivery of the page to the browser with it's white space stripping and defalting (gzip) methods. It also searches for any external js sources and then collects them all into one resource so instead of loading 3-4 js files it loads 1. If the js file can't be combined with others (ie if it is server dynamically through php) it  leaves it alone, but the output of the dynamic js is still compacted, deflated and cached all the same. The same method is applied with css.

It can also perform other functions such as moving all the discovered css to just below the opening <head> tag and the js to just above the closing </body> tag for optimisation purposes, but they are rather superfluous and I coded them just for shits and giggles.

The basic results of the whole plugin shrink the required output of one Elgg page load from 300kb to 44kb, then with the etag and last-modified headers a page can load in as little as 2kb. Vastly speeding up the delivery, saving 298kb in bandwidth (saving an estimated 1.5GB per day based on 5 (max) page loads per second over 24 hours).

So as you can see, it may well be worth installing this one.

(Note: all the above mentioned settings are configurable in the plugins' admin panel)

Georg Westphalen

a former physician specializing in creative concepts, outrageous comics, hilarious character designs and urban philosophy.