From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR0pA-0001jM-GE for qemu-devel@nongnu.org; Mon, 08 Sep 2014 11:25:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XR0p4-0008Bo-8Y for qemu-devel@nongnu.org; Mon, 08 Sep 2014 11:25:48 -0400 Received: from dew.nodalink.com ([95.130.14.197]:42963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR0p3-0008B6-N8 for qemu-devel@nongnu.org; Mon, 08 Sep 2014 11:25:41 -0400 Date: Mon, 8 Sep 2014 15:25:39 +0000 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140908152539.GA9641@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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <540DC6B2.8060704@redhat.com> 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: Paolo Bonzini Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , peter.maydell@linaro.org, qemu-devel@nongnu.org, =?iso-8859-1?Q?Beno=EEt?= Canet 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 period, = 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=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 = second > worth of data. >=20 > The problem is the delay in getting data, which can be big for the minu= te- > and hour-based statistics. Suppose you have a spike that lasts 10 seco= nds, > it might not show in the minute-based statistics for as much as 30 seco= nds > 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. So I think the first method you suggested would be the best for a cloud v= m. Best regards Beno=EEt >=20 > Paolo