Received: from eggs.gnu.org ([2001:4830:134:3::10]:56856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUDj-0004kJ-5c for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:13:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTUDd-0008H6-Nd for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:13:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUDd-0008GC-G7 for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:13:17 -0400 From: Markus Armbruster References: <1410178693-23370-1-git-send-email-benoit.canet@nodalink.com> <1410178693-23370-4-git-send-email-benoit.canet@nodalink.com> <540DBD46.7030207@redhat.com> <20140908144936.GA5723@irqsave.net> <540DC6B2.8060704@redhat.com> <20140908152539.GA9641@nodalink.com> Date: Mon, 15 Sep 2014 13:13:08 +0200 In-Reply-To: <20140908152539.GA9641@nodalink.com> (=?utf-8?Q?=22Beno=C3=AE?= =?utf-8?Q?t?= Canet"'s message of "Mon, 8 Sep 2014 15:25:39 +0000") Message-ID: <877g15xhkr.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 3/3] util: Add an utility infrastructure used to compute an average on a time slice List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Beno=C3=AEt?= Canet Cc: =?utf-8?Q?Beno=C3=AEt?= Canet , Paolo Bonzini , qemu-devel@nongnu.org, peter.maydell@linaro.org Beno=C3=AEt Canet writes: > On Mon, Sep 08, 2014 at 05:09:38PM +0200, Paolo Bonzini wrote: >> Il 08/09/2014 16:49, Beno=C3=AEt Canet ha scritto: >> >> > - create two windows, with twice the suggested expiration period, a= nd >> >> > return min/avg/max from the oldest window. Example >> >> >=20 >> >> > t=3D0 |t=3D1 |t=3D2 |t=3D3 = |t=3D4 >> >> > wnd0: [0,1) |wnd0: [1,3) | |wnd0: [3,5) | >> >> > wnd1: [0,2) | |wnd1: [2,4) | | >> >> >=20 >> >> > Values are returned from: >> >> >=20 >> >> > wnd0---------|wnd1---------|wnd0---------|wnd1---------| >> >=20 >> > This is neat. >>=20 >> Alternatively, you can make it probabilistically correct: >>=20 >> t=3D0 |t=3D0.66 |t=3D1.33 |t=3D2 = |t=3D2.66 >> |wnd0: [0.66,2) | |wnd0: [2,3.33)= | >> wnd1: [0,0.66) | |wnd1: [1.33,2.66) | = | >>=20 >> Return from: >>=20 >> wnd1-----------|wnd1-------------|wnd0---------------|wnd1----------= ---|wnd0 >>=20 >> So you always have 2/3 seconds worth of data, and on average exactly 1 s= econd >> worth of data. >>=20 >> The problem is the delay in getting data, which can be big for the minut= e- >> and hour-based statistics. Suppose you have a spike that lasts 10 secon= ds, >> it might not show in the minute-based statistics for as much as 30 secon= ds >> after it ends (the window switches every 40 seconds). >>=20 >> For min/max you could return min(min0, min1) and max(max0, max1). Only = the >> average has this problem. >>=20 >> Exponential smoothing doesn't have this problem. IIRC uptime uses that. > > I am writing this so cloud end users can programatically get informations= about > their vms disk statistics. > > Cloud end users are known to use their cloud API to script the > elasticity of their > architecture. > Some code will poll system statistics to decide if new instances must > be launched > or existing instances must be pruned. > This means introducing a delay in the accounting code would slow down the= ir > decisions. > > min and max is also useful to know since it gives an idea of the deviatio= n. For what it's worth, the algorithm in the Dr. Dobb's Paolo referenced can compute a standard deviation. Can we figure out what users really want, standard deviation, min/max, or both? [...]