Skip to content

Make basicstats faster #4723

@markusr

Description

@markusr

Steps to reproduce:

  1. Config basicstats to only do
stats = ["count", "min" , "max" , "mean"]

Expected behavior:

"mean" is calculated at the Push by dividing

v.sum / v.count

Actual behavior:

All values also variance are calculated on each Add
https://github.com/influxdata/telegraf/blob/master/plugins/aggregators/basicstats/basicstats.go#L107

Additional info:

I tested this on a raspberry pi 3.

After removing the "online" calculation part the cpu usage dropped from 72% to 35%. (3000 metric per second input and 5s aggregation time).

Another idea would be to add sum and mean to the minmax aggregator or a complete new aggregator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceproblems with decreased performance or enhancements that improve performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions