Optimizing the latest MidCOM

cover image for Optimizing the latest MidCOM

I drove from Turku to Helsinki early in the morning with a Land Rover that didn’t have headlights. Since then have been hunting performance issues in latest beta of MidCOM - the component architecture used by Midgard CMS.

MidCOM is a powerful PHP framework providing functionalities like data abstraction, access control lists, templating and revision control. Unfortunately with such power also comes the risk of developers losing track of how much data is getting queried and used in their application.

In this case I was working with a customer that has over two hundred thousand articles in their Midgard installation - the same one Piotras talked about earlier. Midgard generally is considered as a mid-range CMS, and so most sites have a lot less data than this one, but still higher-end performance is also important.

So after turning off caches and turned all the debugging output up to maximum, Piotras and I started going over the logs and finding places where queries were being duplicated needlessly. Attention quickly shifted to the usual suspects, ACL and navigational abstraction, with quite impressive results:

Sep 25th Sep 26th
2pm 5pm 9pm 4pm
Log lines 12,501 1,377 738 387
SELECTs ~5,000 1,385 642 542
Time 32s 3s 2s <1s

Now, the end result of 640 queries per page view may sound like a lot, but I have to note that the particular page we’re viewing includes some 150-200 content objects, each with metadata, ACLs and parameters.

In a regular situation on a site of this scale we would obviously turn down the logging level, deploy memcached for ACL caching, and possibly run a Squid reverse proxy. With those set up, Midgard really flies.

Now memcached is only being used for ACL and parent hierarchy caching, but in near future we may implement also things like NAP caching with it.

In the other news

Polish translation of MidCOM 2.6 is just off the press, courtesy of Solt:

MidCOM 2.6 metadata editor in polish

In addition to user interface localization, I’ve been working on multilingual content in MidCOM. At the moment the situation looks really promising

Read more Midgard posts.