[rrd-users] MAX doesn't work as expected: peaks are filtered

Cristian Ghezzi rrd-users01 at ghezzi.net
Sun Aug 15 15:43:08 MEST 2004


I found the behaviour of rrdtool when using the MAX CF to be misleading 
to say the least.
It appears that all values inserted in the database within the last STEP 
period are always averaged when creating a PDP, even when I'm going to 
use the value in a MAX RRA, thus creating spurious values.
The manual seems to confirm this behaviour:
"If the interval between samples is less than ``heartbeat'', then an 
average rate is calculated and applied for that interval."

This means that if I insert more than one value within a step, I will 
not find the MAX of those values in the database, but an average value 
which will always be lower than expected.
Furthermore, even if I update the database with one value per STEP, I 
must ensure that updates are aligned to the STEP period, otherwise I 
will get an average value again and peaks will be cut..

Example:

I want to plot the maximum response time of a web server during the past 
20 minutes, plotting updated graphs every 10 seconds.

- I create a database to store the response time with PDPs every 10 seconds
- I keep the MAXimum value of the response time in a RRA

$ rrdtool create test.rrd --step 10 DS:source1:GAUGE:20:U:U 
RRA:MAX:0.5:1:120

- If I insert three values (100, 200, 300) STEP-aligned (60, 70, 80) and 
everything works fine

$ rrdtool update test.rrd 1092402360:100 1092402370:200 1092402380:300
$ rrdtool fetch test.rrd MAX --start 1092402360 --end 1092402420
                     source1

1092402360: 1.0000000000e+02
1092402370: 2.0000000000e+02
1092402380: 3.0000000000e+02
1092402390: nan
1092402400: nan
1092402410: nan
1092402420: nan

- If the update time occurs at half-STEP (85, 95), the two values (400, 
500) are averaged (450)

$ rrdtool update test.rrd 1092402385:400 1092402395:500
$ rrdtool fetch test.rrd MAX --start 1092402360 --end 1092402420
                     source1

1092402360: 1.0000000000e+02
1092402370: 2.0000000000e+02
1092402380: 3.0000000000e+02
1092402390: 4.5000000000e+02
1092402400: nan
1092402410: nan
1092402420: nan

- In the above example, I get a value of 450 which is neither 400 nor 
500. It is a value that never got inserted in the database,
therefore is a wrong value which never occurred. Still I can accept this 
behaviour if I assume that the response time increased linearly with 
time from 400 to 500.

- The next update is again at half-STEP (05) with a value of 400

$ rrdtool update test.rrd 1092405105:400
$ rrdtool fetch test.rrd MAX --start 1092402360 --end 1092402420
                     source1

1092402360: nan
1092402370: 2.0000000000e+02
1092402380: 3.0000000000e+02
1092402390: 4.5000000000e+02
1092402400: 4.5000000000e+02
1092402410: nan
1092402420: nan

- What happens is clearly wrong: the value of 500 inserted in the middle 
of the previous STEP, which is an absolute maximum for the whole period, 
has been smoothed down to 450.

Am I doing something wrong?
Is the only solution to always update the database with STEP-aligned 
values?
Is there another approach to the problem?
Is RRDTool unsuitable for the task?


Thank you

Cristian Ghezzi

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list