Francois Marier: Improving the performance of Request Tracker by reducing latency
Request Tracker is a really neat support tool, but one of the common complaints I heard from people using it during a previous project was that it was pretty slow.There wasn't much we could do about the (overloaded) server it was running on, but I found that enabling mod_deflate really helped.
After watching this great video though, I was inspired to look into it a bit more, focussing this time on latency.
Description of tests
- RT 3.6.7-5+lenny4
- Running on a Debian Lenny vserser.
- Server is on the LAN.
- Firefox 3.6.6 client (with Firebug 1.5.0)
Also note that I was looking for the "best case" for each of the different configurations and so each screenshot was taken after reloading the homepage 10-20 times to maximize cache hits (thanks in large part to mod_expires).
(Is there a nice automated way of measuring average latency?)
Stock RT 3.6Using the default apache2-modperl2 config file (as supplied by RT), here's what the homepage (logged in as root) looked like before I changed anything:

The purple section here indicates the time spent waiting for the server. This shows that the server (running Mason inside mod_perl) is doing quite a bit of processing, including a lot more work than you'd expect while serving static files. It's quite impressive to see how fast the images are being served (directly by Apache) in comparison with the Javascript and the CSS files (which go through Mason).
The reason while Javascript and CSS files have to be served by mod_perl is that they are in fact templates. They contain a few Mason variables which must be substituted before being served.
Looking into it further though, all of these replacements have to do with variables defined in RT_SiteConfig.pm (mostly the install path). Here's an example:
var path = "" ? "" : "/";which gets turned into:var path = "/rt" ? "/rt" : "/";So as long as these paths don't change, then there is no need to re-generate these files.Static Javascript and CSSThis next diagram was produced after configuring Apache to serve all Javascript and CSS files directly from Apache:

The way I did that (without modifying any of the original files) was by saving the Javascript/CSS sent to the browser and using mod_rewrite rules to serve these files instead of the original templated ones:
# Serve static files directly
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/ahah.js$ /var/www/rt/ahah.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/cascaded.js$ /var/www/rt/cascaded.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/class.js$ /var/www/rt/class.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/combobox.js$ /var/www/rt/combobox.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/list.js$ /var/www/rt/list.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/titlebox-state.js$ /var/www/rt/titlebox-state.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/js/util.js$ /var/www/rt/util.js
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/css/3.5-default/main-squished.css$ /var/www/rt/main-squished.css
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/css/print.css$ /var/www/rt/print.css
RewriteRule ^/usr/share/request-tracker3.6/html/NoAuth/webrtfm.css$ /var/www/rt/webrtfm.css
Removing unnecessary images
Finally, one thing I noticed from this last graph is that the rounded corners in the theme require a number of small images. While these don't take a whole lot of bandwidth, they do require quite a bit of back and forth between the browser and the server.
So I replaced all of the "rounded corner" images in the main-squished.css file with the following CSS attributes:
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
(yes, Internet Explorer users probably don't get the rounded corners... oh well)
This eliminated a number of roundtrips and shaved off a few more milliseconds:

Merging CSS and Javascript filesBy this stage, the pages are pretty snappy so there is not much to be gained anymore, but I figured I'd try to reduce the latency a bit more by combining all Javascript files into one (and doing the same for CSS files with the exception of print.css). This is what I got:

(Note that I also took the opportunity to minify both squished files to reduce the filesize.)
Not a huge improvement and I unfortunately had to copy quite a few Mason templates from /usr/share/request-tracker3.6/html/ to /usr/local/share/request-tracker3.6/html/ and then replace all of the script tags with a single one in html/Elements/Header.
Others things to look intoI've stopped here, but there might be ways to further reduce the processing time on the server (hence the latency) by tuning mod_perl/Mason or Postgres. The RT wiki also has a few pointers.
Replacing Apache with Nginx (which means moving to FastCGI) was something I considered, but after trying it out, it turned out that it would add about 100ms of extra latency.
Feel free to leave a comment if you've found something else that makes a big difference on your site.
Bug-Squashing-Party in Munich
We are

Currently I own and use an iPhone 3G. I bought it almost two years ago, when the local phone provider LMT started offering the iPhone legally. I had a pretty good experience with it most of the time, but now it is showing its age:
Last weekend (2010-07-02 2010-07-04) nine people met at the FAI developer workshop at 


Some time ago, someone posted to a development mailing list about
a piece of code, Cc:ing some people who had modified the code in
recent past. Within hours, the original author replied to complain
about not being Cc'd.
Several thoughts went through my mind:
I m a Debian developer since 1998 and have been 
Today, virtually all of the free software available can be found in packaged form in distributions like Debian and Ubuntu. Users of these distributions have access to a library of thousands of applications, ranging from trivial to highly sophisticated software systems. Developers can find a vast array of programming languages, tools and libraries for constructing new applications.
This is possible because we have a mature
My girlfriend and I were out picking up a cake at the bakery last week, when my phone rang:


Getting key verification working for pbuilder.
It's been on the TODO list, and after some prodding, I've
finally gotten around to getting something implemented.
During the last three months and since my 
I was planning to attend 
Thank you to everyone who came to see me sing in the Southampton
Philharmonic Choir this evening, and to those supporting from afar.
My favourite parts, naturally, were the phrases in Villa-Lobos's
Choros 10 that include fortissimo low F notes. There's a low E at one
point in Daphnis et Chloe, but it's pianissimo.
Now that disk space is cheap, it makes more and more sense to rip
music and store it in FLAC format. I used to use abcde to encode
directly to Ogg Vorbis, but a while back I decided to re-rip. The
disks in the server at home now have lots of hours of music in a nice
lossless format ready for easy playback on various machines on the
network.
However, that's not all I need. I also want to be able to create
Ogg Vorbis files for my own music player with limited space. And Jo's
Ipod won't play either .ogg or .flac (yay for closed devices!)... At
least I now have readily-available original quality music already on
hard disk, so I don't need to go and find CDs again. But I really
don't want to have to work through my directories of music by hand,
re-encoding individually.
My solution: write a filesystem that will read in the .flac files
and convert to .ogg or .mp3 on the fly. Now I can simply read the
files I want off the server (via sftp/rsync/whatever) and it will
create them for me!
So, fuse-music is my first attempt to do this. It's a simple perl
program that works using the perl FUSE bindings to generate a
pseudo-filesystem where a tree of .flac files will appear as a tree of
.ogg or .mp3 files instead. It's not wonderfully fast (as encoding
takes time), but it works. The only major difficulty I have at this
point is calculating the sizes of the output files: if I want rsync to
work reliably then the reported sizes need to be static and
correct. But it's not possible (AFAICS) to predict the size of an MP3
or Ogg Vorbis file without actually doing the encoding and
measuring the output size. So (ick!) that's what the code currently
does when necessary. It caches the output size in a perl hash DB so
the work is only needed once per file; ideally I'd like to not to have
to do this at all!
If this sounds interesting at all, feel free to have a look at and
play with the
code: