# [rrd-users] VDEF, 95th percentile and graph width

Martin Sperl rrdtool at martin.sperl.org
Thu Sep 4 15:00:40 CEST 2014

```Well - the only way around this to some extend is by defining the step with your def not allowing rrdtool to select the right value itself:
DEF:in=foo.rrd:in:AVERAGE:step=300

But then you have to make sure that the whole [start:end] time-range you are wanting the 95th percentile for is available in the RRA with steps=1.
This means in effect that rows needs to be very big (and thus the rrd-file).

Only way arround this is calculate the current Xth percentile and adding that calculated value to a separate rrd file.

But still: how would you mathematically correct consolidate those calculated percentiles in the new RRD file - there is no way to correctly calculate the effective percentile in such cases.
There may be good approximations (assuming you store multiple percentiles 90,91,92,93,94,95,96,97,98,99,100 plus the number of measurements for each of those consolidations (the ones that are NOT NULL)), but there will always be corner cases that do deviate.

If you calculate the 95th percentile every 5 minutes over the last 24 hours, then the MIN/MAX/AVERAGE RRA consolidations should be sufficiently smooth for you to keep your "general" picture also from a trending perspective.

That is all you can really do.

Martin

On 04.09.2014, at 14:21, Marius Karthaus <lists at karthaus.nl> wrote:

> Hello list,
>
> While searching the web on how to calculate the 95th percentile from an RRD, most results return something like:
>
> rrdtool graph graph.png \
> DEF:in=foo.rrd:in:AVERAGE \
> DEF:out=foo.rrd:out:AVERAGE \
> CDEF:inb=in,8,* \
> CDEF:outb=out,8,* \
> CDEF:allbits=inb,outb,MAX \
> VDEF:pct=allbits,95,PERCENT \
>
> However I find that the result produced this way is highly incorrect. Not only that, but the result is greatly influenced by the width (-w) option for generating the graph. On my test dataset changing -w from 400 to 1000 pixels (while keeping all other things the same) the 95Th percentile swings back and forth between 17 and 38 Mbit. Am I doing something wrong, or is this behaviour to be expected?
>
> My create command, the measurements I'm inserting are 'bytes transferred since last measurement'
>
> # rrdtool create foo.rrd --start \$start --step 300 DS:in:ABSOLUTE:600:0:U DS:out:ABSOLUTE:600:0:U RRA:AVERAGE:0.5:1:100000
>
> Regards,
> Marius
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

```