Speeding up midgard

Midgard makes a lot of database queries when it is constructing its pages. This means that its performance is less that if you were serving static html pages. There are a number of possibilities for improving the performance of midgard through caching. These include using mod_midgard_preparser which caches the php pages built by midgard so they can just be executed rather than have to be reconstructed every page view. There is also the option of using an external program to perform reverse proxying. This program sits between your midgard server and the web and stores the constructed html pages in its cache and then serves them when they are requested. This can offer significant performance improvements but reduces your ability to personalise your site and can require some additional headers in your pages, luckily this is easy to add to a Midgard website and has now been incorporated into the Aegir sample site. There is also the possibility of caching in the database. This is available in MySQL version 4 so is something to look forward to when midgard works with the newer version of mysql.

In this section I will look at some benchmarking that I ran on midgard without caching and then without caching and then cover the steps involved in getting squid to work with a midgard based website.