Putting this here for reference - at a later point I'll compare with D7. This is about performance of the redirector with cached pages. Because serving cached pages is much faster than non-cached, the time taken by ML Redirect to do its processing can have an impact.

MLR's handling of cached pages can be switched off. In that case, it will have no performance impact (but you won't get redirects for cached pages either of course.)

Testing using a url which will not be redirected - the overhead is the time taken for MLR to decide that no redirection is needed. Under normal circumstances this is the most important case, because it should represent the highest proportion of requests.

D6 Branch - 6.x-2.6

Requests per second for cached pages, measured with Apache ab
Without MLR With MLR
aliased path 95 (100%) 75 (79%)
node path 100 (100%) 82 (82%)

D7 Branch - 7.x-dev at 21-Sep-11

Requests per second for cached pages, measured with Apache ab
Without MLR With MLR
aliased path 223 (100%) 116 (52%)
node path 223 (100%) 135 (61%)

Comparing D7 with D6, cached pages are clearly served much more quickly with or without MLR, but for the same reason MLT's overhead is more significant.

This is with a fairly simple Drupal configuration running on my lap-top. Using APC for PHP caching but standard Drupal database for page cache. Results might be different if using cacherouter with APC. I do have devel module installed and that might be having an impact. So, just a quick test, but indicates what I would expect, the time taken by MLR to figure out that a request should not be redirected is not insignificant with cached pages - it would be fairly insignificant with non-cached pages.

There's no easy solution for this. I think it could probably be speeded up using cacherouter/APC and some extra caching inside MLR to remember what a particular url + language+preference combination does not need to be redirected. But that would add considerable complexity (e.g. how to delete expired/invalid cache entries.) Another approach would be to try using fewer calls to Drupal internals so as to avoid loading Drupal include files and modules during the bootstrap phase.

GlobalRedirect doesn't (can't) redirect requests to cached pages (unless it's changed since I last looked at it) so doesn't have this issue. GR doesn't handle languages the way MLR is designed to do, but as I've said elsewhere, may be a better choice, depending on your needs.

Comments

Andy Inman’s picture

Issue summary: View changes

tidied table

Andy Inman’s picture

Issue summary: View changes

Updated with D7 results

kmonty’s picture

Title: MultiLink Redirect, performance » MultiLink Redirect Cached has severe performance impacts
Version: 6.x-2.6 » 7.x-2.x-dev
Priority: Normal » Major

Confirming this is an issue. This is coming from the implementation of hook_boot(). I'm not positive, but I believe it's coming from the drupal_loads:

// Load the minimum required MultiLink and Drupal code.
$needed = array('multilink', 'multilink_redirect', 'locale');
foreach ($needed as $module) {
  drupal_load('module', $module);
}
Andy Inman’s picture

Hi @kmonty. Thanks for the info, but please understand this is not a bug nor (IMHO) a design fault - the module needs to implement hook_boot() in order to work at all, and the subsequent module loads are also necessary. Some improvement could probably be achieved by using an alternative cache backend, as mentioned above, but since that would also speed up the delivery of cached pages, the impact of using MLRC would probably be unchanged.

Andy Inman’s picture

Status: Active » Closed (works as designed)