pcp
[Top] [All Lists]

Re: [issue] pmwebd graphite api performance issue

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Subject: Re: [issue] pmwebd graphite api performance issue
From: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Date: Mon, 27 Jul 2015 20:26:29 -0400
Cc: pcp@xxxxxxxxxxx, aurelien.gonnay@xxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <55B6B597.1070909@xxxxxxxxxxxxxxxx>
References: <a00f452763fd43f98eb5123d3ec0c3cf@xxxxxxxxxxxxxxxxxxxxxxxxx> <55B69826.7030103@xxxxxxxxxxxxxxxx> <y0mpp3d1bqq.fsf@xxxxxxxx> <55B6B597.1070909@xxxxxxxxxxxxxxxx>
User-agent: Mutt/1.4.2.2i
Hi, Ken -

> Does not necessarily require any additional cacheing ... I was suggest 
> an algorithmic change, from
> [...]
> traverse pmns
>       salt away each metric of interest
> foreach metric of interest
>       skip metric if already done
>       get metadata
>       process this _and_ all other metrics with the same indom

That could work too, though doing it naively could involve O(#metrics**2)
iteration, which could itself be heavy.  Doing it the cache way in pmwebd
turned out to be easy:

git://sourceware.org/git/pcpfans.git fche/pmwebd


commit 001ea046aa3701faaabb1d99b69d40294e33174e
Author: Frank Ch. Eigler <fche@xxxxxxxxxx>
Date:   Mon Jul 27 20:17:39 2015 -0400

    pmwebd graphite mode: elide repeated indom searching
    
    It was reported that for some larger archives, pmwebd was taking
    noticable time running pmGetInDomArchive.  This effort was being
    repeated for every metric, whereas it could be reused across metrics
    with the same indom.  We now do this by memoizing the wildcard-filtered
    instance names during pmns iteration.  (The cache is thrown away after
    pmns traversal.)
    
    There are no intended changes in visible behavior except for speedup;
    previous QA is sufficient.


- FChE

<Prev in Thread] Current Thread [Next in Thread>