• Home
  • Consultancy
  • Contact
  • Weekly roundup: Caching in

    November 7th, 2008 by Marcus Povey

    This week saw the election of a new president of America – triggering a massive spike in hope levels worldwide. At last the Bush years are drawing to a close.

    On the Elgg front, I spent a good portion of the week optimising various parts of the system and drastically reducing the number of queries per page.

    A lot of this was done by introducing a query cache into database.php which caches the results of individual queries. I also introduced some new delayed execution functionality on database queries – letting you delay some database operations until after the page has been sent to the browser.

    All of these tweaks have slashed the number of queries being executed per page.

    This week I also began to experiment with memcache – currently caching entities, datalists, metastrings and meta data. Reducing the number of queries per page to ~7 once the cache has been populated.

    I also did a little bit of work on the activity stream, river and syndication… but more on this later…

    The lesson this week…

    October 7th, 2008 by Marcus Povey

    The lesson this week has got to be “Profiling is a Good Thing”. While working on the new Elgg community site this week, it quickly became clear that the way the River code was written was horribly inefficient.

    So, I had to optimise it.

    Unfortunately this necessitated a schema change to the system log (a good test for the Elgg update scripts). It also required some changes to the way the river views are constructed.

    The details of these changes are documented over here. Turns out to be a bit of a blessing in disguise; letting us speed up the river while at the same time increasing the number of events a plugin can hook into as well as standardising the views hierarchy.

    The down side is that after the upgrade site rivers will appear to be blank – this is because while the system log is still there, the format of the log and the way the river code hooks into it has changed.

    The change also means that plugins which hook into the river will also need to modify their views hierarchy slightly.

    All content is © Copyright Marcus Povey 2008-2010 and released under a Creative Commons licence unless otherwise stated.

    Creative Commons License