Debugging MidCOM

We were clueless with sites Pyhä and Luosto. Those sites get - according to Google Analytics - over 13,000 hits per day and on the peak hours the site was crawling.

First of all, MidCOM cache engine wasn't working. I knew that this was the case, but I couldn't figure out why on Earth it wasn't. I couldn't see any sign to explain why cache refused to work on the major sites when on other sites in the same sitegroup cache was working. '/midcom-admin/settings' wasn't to blame.

So, after fighting with this problem for several weeks we contacted Torben who, as far as I know, wrote the cache engine.

Torben had a few very useful tools to debug. To prevent overflowing debug log he overrode settings of '/midcom-admin/settings/ by placing the following snippet in '/sitegroup-config/midcom-template/config-afterauth':


<?php
// Enable custom log for a certain IP - change it according to your own IP
if ($_SERVER['REMOTE_ADDR'] == '84.34.133.194')
{
    $GLOBALS['midcom_config_local']['log_filename'] = '/tmp/custom_log.log';
    $GLOBALS['midcom_config_local']['log_level'] = 4;
}
?>

From that he could see that I was using MidCOM session handlers to change the font size (a feature requested by the ad agency which ordered those sites). He pointed out:

The site appearantly uses PHP Sessions to keep track of UI font sizes (at least there is a 'font_size' session key in the domain 'fi.pyhaluosto'). This effectivly puts the entire HTML-page output of the site into no_cache mode.

The doc part for this is not easily reachable, as it is not in midcom_service_session but in its singelton implementation midcom_service__sessioning: "All requests involving this service will always be flagged as no_cache." [1]

[1]: http://www.midgard-project.org/api-docs/midcom/stable/midcom.services/midcom_service__sessioning.html

Avoiding this is not possible, as the Session system cannot reliably detect if a session is unitialized, unset or just unused. Besides, the very idea of having user-definable font-sizes (which I assume is what we're talking about) contradicts the concept of a rendered-page-cache.

Note: related issues are updated in midcom_debug in documentation on www.midgard-project.org.

Back