Project Mantis speedup

The Problem

Our bugtracking system Mantis has - when run out of the box - performance issues on page loads (times out, "Maximum execution time of 30 seconds exceeded" logged in error_log). This bottleneck can very likely be attributed to the amount of projects that we host and gets even worse through the hardware of our www box which is a T2000 (read: poor single-thread performance). We reported the problem upstream a while ago, but there was no response. We produced a patch against 1.1.6 as a workaround . It worked fine for 1.1.6 and alleviated the page timeouts, but unfortunately it wasn't coordinated / merged with upstream and doesn't cleanly apply against 1.2.x updates, thus needs revisiting.

The Mission

Test drive the the latest Mantis 1.2.5, identify architectural bottlenecks, and ideally address them in a way so that they can be merged upstream (consider upstream coding standards). Suggested approach: run Mantis with PHP's xdebug enabled, have it generate call profile files (cachegrind), and inspect them with KCachegrind (from a Kubuntu live CD for example, alternatively precompiled binary for Windows). Identify and fix bottleneck. Prepare patch for upstream. Iterate.

The Tools

  • www-mockup server for testing purposes (also/same T2000) … check
  • database dump and config from our live Mantis installation … check, www-mockup:/var/tmp/mantis/MANTIS-2011-06-08.09-15-51.sql.bz2 (cksum: 4145709192)
  • verify that mails on www-mockup are caught by postfix & /var/mail/catchall … check
  • Latest Mantis release installed on www-mockup:/var/www/www-mockup.opencsw.org/htdocs/mantis/mantisbt-1.2.5/ … check
  • Git wrapped over it to produce patches … check
  • php5_xdebug installed on www-mockup … check
  • php5_xdebug loaded into PHP5 on www-mockup … check
zend_extension=/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = /path/for/callprofiles

Then load Mantis pages with XDEBUG_PROFILE as GET/POST/Cookie parameter to generate a call profile file (IIRC ~30MB per file). Copy and inspect with e.g. KCachegrind. The whole setup can all be done on a local laptop of course, don't be surprised when page load times are way faster due to better CPUs. During the last time, I used a local Solaris zone and the capped-cpu feature … think: tangible feedback in terms of load times over improved call profile figures in KCachegrind.

Bottlenecks


Worklog

Testing load times for the all bugs overview page (for all projects) from the command line.

MBASE=http://www-mockup.opencsw.org/mantis/mantisbt-1.2.5
curl -so /dev/null -d project_id=0 -c cookies $MBASE/set_project.php
for repeat in {1..3}; do /usr/bin/time -f "%E" curl -b cookies -so /dev/null $MBASE/view_all_bug_page.php; sleep 5; done

view_all_bug_page.php

Vanilla 1.2.5

0:23.38
0:23.28
0:23.21

my_view_page.php

Vanilla 1.2.5 (exceeds PHP's max_execution time of 30 seconds)

0:30.20
0:30.30
0:30.24
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License