#3 closed patch (fixed)

Faster CGI graphs

Reported by: jo Owned by: jo
Priority: high Milestone: Munin 1.4
Component: master Version:
Severity: normal Keywords:
Cc: None

Description

Right now the CGI graphs are drawn one at a time, reading all the configuration data for each graph drawn. This makes it very slow, especially when viewing a node with a lot of plugins.

Munin should support at least one method of keeping the config (and other information that can be kept) in memory between runs. This can be done through a lot of apache modules (e.g. fastcgi).

Attachments (5)

munin-cgi-graph_fastcgi.diff (4.6 KB) - added by blueyed at 2008-05-11T01:21:46+02:00.
Patch for munin-cgi-graph (Fixed patch, just called "rediff" on the previous one)
munin-cgi-graph_fastcgi.2.diff (11.8 KB) - added by do at 2008-08-12T20:14:25+02:00.
fastscgi patch for trunk
munin-fastcgi-ticket3.diff (8.6 KB) - added by blueyed at 2008-12-19T01:53:06+01:00.
Patch against SVN trunk as described in the previous comment
munin-cgi-graph (8.4 KB) - added by blueyed at 2008-12-19T01:55:18+01:00.
For reference: my munin-cgi-graph (derived from the patch)
munin-graph (40.7 KB) - added by blueyed at 2008-12-19T01:55:35+01:00.
For reference: my munin-graph (derived from the patch)

Download all attachments as: .zip

Change History (14)

comment:1 Changed at 2005-11-29T15:04:39+01:00 by ilmari

  • Priority changed from normal to low

comment:2 Changed at 2006-10-30T00:06:37+01:00 by janl

  • Milestone set to Munin 1.4

comment:3 Changed at 2006-10-30T00:07:03+01:00 by janl

  • Component changed from doc to server
  • Keywords None removed
  • Priority changed from low to normal
  • Severity changed from blocker to normal
  • Version 1.2.0 deleted

comment:4 Changed at 2007-06-14T01:16:53+02:00 by blueyed

The patch provides fastcgi support for munin-cgi-graph. However, it still just "exec"s munin-graph, when new images have to be generated - maybe that could be improved, too.

Changed at 2008-05-11T01:21:46+02:00 by blueyed

Patch for munin-cgi-graph (Fixed patch, just called "rediff" on the previous one)

comment:5 Changed at 2008-07-28T14:44:39+02:00 by frieder

doesn't apply to current svn trunk

comment:6 Changed at 2008-08-12T20:13:52+02:00 by do

Here is a new patch. I do not know whether it works with the semaphore stuff... it works for version 1.2.6 in Debian, though.

Changed at 2008-08-12T20:14:25+02:00 by do

fastscgi patch for trunk

comment:7 Changed at 2008-12-19T01:51:08+01:00 by blueyed

I've reworked my initial patch and fixed the Last-Modified handling.

The current patch includes a patch to munin-graph, which includes a call to utime so the generated images contain the "last update" value. This can be used very effectively by munin-cgi-graph now.

The patch also reverts the "fix" for graph_usable introduced in ticket #499.
Also, I had to change $IPC_KEY to 9340 (like in do's munin-cgi-graph_fastcgi.2.diff, otherwise semget failed). I'm not sure, if this semaphore handling is required after all (or does more harm than good, e.g. if IPC_KEY=9340 fails for others now).

I've also changed the HTTP_IF_MODIFIED_SINCE check, since the previous one did not take the field sent by the browser into account at all (it only triggered the check).

The patch changes the flow as follows:

  1. if the graph is not usable (too old for the current time frame) or reload is forced (ctrl-f5) a new graph gets created
  2. This will have the "last update" time (which graph_usable and $last_modified uses)
  3. If the browser sends last-modified-since, it gets checked against the image's datetime and in case it's recent enough, a 304 gets sent.
  4. Otherwise the image gets sent.

Please consider applying the patch to trunk, so that this (old) ticket can be closed finally.

I'm attaching a patch against trunk and the files as I'm using them (in a 1.2.x install), where munin-graph differs a lot, but munin-cgi-graph is quite the same as in trunk (with the patch).

Thanks.

Changed at 2008-12-19T01:53:06+01:00 by blueyed

Patch against SVN trunk as described in the previous comment

Changed at 2008-12-19T01:55:18+01:00 by blueyed

For reference: my munin-cgi-graph (derived from the patch)

Changed at 2008-12-19T01:55:35+01:00 by blueyed

For reference: my munin-graph (derived from the patch)

comment:8 Changed at 2009-10-27T23:47:25+01:00 by janl

  • Priority changed from normal to high
  • Type changed from enhancement to patch

Pushing up the priority for this - will be in 1.4 if at all possible.

comment:9 Changed at 2009-10-28T01:48:38+01:00 by janl

  • Resolution set to fixed
  • Status changed from new to closed

Patches adapted. Thanks a lot. In r2734.

Note: See TracTickets for help on using tickets.