From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUee-0007mx-QP for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:41:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTUeW-000063-Ry for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:41:12 -0400 Received: from dew.nodalink.com ([95.130.14.197]:55180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUeW-00005e-Lj for qemu-devel@nongnu.org; Mon, 15 Sep 2014 07:41:04 -0400 Date: Mon, 15 Sep 2014 11:41:03 +0000 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140915114103.GA22086@nodalink.com> 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> <877g15xhkr.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <877g15xhkr.fsf@blackfin.pond.sub.org> 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: Markus Armbruster Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , Paolo Bonzini , qemu-devel@nongnu.org, =?iso-8859-1?Q?Beno=EEt?= Canet , peter.maydell@linaro.org On Mon, Sep 15, 2014 at 01:13:08PM +0200, Markus Armbruster wrote: > Beno=EEt Canet writes: >=20 > > On Mon, Sep 08, 2014 at 05:09:38PM +0200, Paolo Bonzini wrote: > >> Il 08/09/2014 16:49, Beno=EEt Canet ha scritto: > >> >> > - create two windows, with twice the suggested expiration perio= d, and > >> >> > 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=3D= 2 |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 second > >> worth of data. > >>=20 > >> The problem is the delay in getting data, which can be big for the m= inute- > >> and hour-based statistics. Suppose you have a spike that lasts 10 s= econds, > >> it might not show in the minute-based statistics for as much as 30 s= econds > >> after it ends (the window switches every 40 seconds). > >>=20 > >> For min/max you could return min(min0, min1) and max(max0, max1). O= nly the > >> average has this problem. > >>=20 > >> Exponential smoothing doesn't have this problem. IIRC uptime uses t= hat. > > > > I am writing this so cloud end users can programatically get informat= ions 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= their > > decisions. > > > > min and max is also useful to know since it gives an idea of the devi= ation. >=20 > 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? I'll ask to my test subject. >=20 > [...]