summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3443ff6)
raw | patch | inline | side by side (parent: 3443ff6)
author | Stefán Þorvarðarson <stefanth@siminn.is> | |
Thu, 10 Mar 2016 14:57:11 +0000 (14:57 +0000) | ||
committer | Stefán Þorvarðarson <stefanth@siminn.is> | |
Thu, 10 Mar 2016 14:57:11 +0000 (14:57 +0000) |
At present graph.cgi is 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.
Patch originally from:
http://mailman.verplant.org/pipermail/collectd/2011-May/004519.html
The patch was improved so that it correctly handles multiple hostnames.
I'm seeing a 5x improvement in speed, the original patch creator
had a 24x speedup.
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.
Patch originally from:
http://mailman.verplant.org/pipermail/collectd/2011-May/004519.html
The patch was improved so that it correctly handles multiple hostnames.
I'm seeing a 5x improvement in speed, the original patch creator
had a 24x speedup.
contrib/collection3/lib/Collectd/Graph/Common.pm | patch | blob | history |
diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm
index cc7e141f8828380fb8978c796faf4df46f4c6653..31c530f466987f403b76db500a117a9cb1b5a085 100644 (file)
my $ident = shift;
my $all_files;
my @ret = ();
+ my $temp;
+ my $hosts;
my $cache_key = ident_to_string ($ident);
if (defined ($Cache->{'get_files_by_ident'}{$cache_key}))
return ($ret)
}
- $all_files = _get_all_files ();
+ if ($ident->{'hostname'})
+ {
+ $all_files = [];
+ $hosts = $ident->{'hostname'};
+ foreach (@$hosts)
+ {
+ $temp = get_files_for_host ($_);
+ push (@$all_files, @$temp);
+ }
+ }
+ else
+ {
+ $all_files = _get_all_files ();
+ }
@ret = grep { _filter_ident ($ident, $_) == 0 } (@$all_files);