[collectd] [PATCH] Collection3: ~24x improvement to graph rendering speed on large systems

David McBride dwm at doc.ic.ac.uk
Mon May 16 13:21:35 CEST 2011

Hello all,

Attached is a patch to the CollectD::Graph::Common library used by graph.cgi,
part of the Collection3 perl scripts shipped with CollectD under contrib/.

At present graph.cgi extremely slowly on servers with large numbers of RRD
files.  This is because it issues an unnecessary stat() call to _every_ RRD
file on the local system before loading and rendering graph data.

I've chased this behaviour down to the function get_files_by_ident() in
CollectD::Graph::Common -- which even has some faster, more specific code
commented out that doesn't work -- presumably because the internal
data-structures it used evolved in an incompatible way.

I've uncommented it out, and applied a trivial fixup so that it matches the
internal data-structures used internally.

On my system, which has on the order of 100,000 individual RRD files, this
patch speeds graph rendering (in the hot-cache case) from 6s to just ~0.25s, a
24x speedup.

David McBride <dwm at doc.ic.ac.uk>
Department of Computing, Imperial College, London
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd-graph-performance.patch
Type: text/x-patch
Size: 582 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110516/d3dd9402/attachment.bin>

More information about the collectd mailing list