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

Steve Shipway s.shipway at auckland.ac.nz
Thu Sep 4 23:13:59 CEST 2014

```A 95th Percentile calculation will become progressively more inaccurate as the underlying data are averaged out.  You will always have a measure of inaccuracy built in due to your sampling rate -- the smaller the sample interval, the more accurate you get -- plus on top of this, you may be using lower-resolution RRAs or having implicit consolidation caused by the graph time-per-pixel.

As long as you have a resolution-1 RRA available for the time window in question (which you do) then you should be able to avoid the first of these issues.  If you have multiple RRAs you need to be careful to ensure the correct high-resolution one is used, even if a lower resolution one would be more efficient; you can do this by  specifying the step in the underlying DEF that is used by the VDEF, eg:

DEF:x=foo.rrd:x:AVERAGE:step=60
VDEF:pct=x,95,PERCENT

The second problem is the implicit reduction of the dataset caused by the seconds-per-pixel of the graph to be rendered.  You can avoid this by using a separate DEF for the Percentile calculation so it is unaffected by the work done for the graphing.

As you change the time window of the graph, the seconds-per-pixel will change, which will dynamically alter the selection of underlying RRA and implicit reduction.  By specifying the step size etc you prevent this; however it can result in very large datasets to be consolidated on the fly when working with large timespans (eg, yearly) which can be computationally heavy.

rrdtool graph graph.png \
DEF:in=foo.rrd:in:AVERAGE \
DEF:out=foo.rrd:out:AVERAGE \
DEF:inpct:foo.rrd:in:AVERAGE:step=300 \
DEF:outpct:foo.rrd:out:AVERAGE:step=300 \
CDEF:inb=in,8,* \
CDEF:outb=out,8,* \
CDEF:allbitspct=inpct,8,*,outpct,8,*,MAX \
CDEF:allbits=inb,outb,MAX \
VDEF:pct=allbitspct,95,PERCENT \
LINE:inb#00ff00:Inbound \
LINE:outb#0000ff:Outbound \
GPRINT:pct:"Percentile is %.2f"

Steve

Steve Shipway
University of Auckland ITS