Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 530E4200BC5 for ; Tue, 22 Nov 2016 13:36:29 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 50031160B0C; Tue, 22 Nov 2016 12:36:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 74BE2160B0A for ; Tue, 22 Nov 2016 13:36:28 +0100 (CET) Received: (qmail 62680 invoked by uid 500); 22 Nov 2016 12:36:27 -0000 Mailing-List: contact dev-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list dev@flink.apache.org Received: (qmail 62668 invoked by uid 99); 22 Nov 2016 12:36:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2016 12:36:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 3A2011A992B for ; Tue, 22 Nov 2016 12:36:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.38 X-Spam-Level: ** X-Spam-Status: No, score=2.38 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id KDiUvXZ-aJ-Q for ; Tue, 22 Nov 2016 12:36:23 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id D2EC45FB90 for ; Tue, 22 Nov 2016 12:36:18 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id t79so22761347wmt.0 for ; Tue, 22 Nov 2016 04:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=qPGNZc3586GivLruWqE7INNBHJxnioSHwaPotAfVv78=; b=tubfp7heZC+Ax6BDFr+ts/aVifwgmfAnyDRqQRgiXB65thQsAnUSsvo+T+CiTKgQzs oYA5j4xdEfBKNPqYsmJRvZdgITIaPL9NBte8dwas0B1BJHlwyh/Can4/leQzyFqy7b9f Y/hWbDoyJSpZHfpif3aJiox9xr4n4n6tJ8h4j4yGky8sBuO+8P1MBFbX73Ceon3nXoXk lwlePtbHrOTMfkI0Um3wAPgYkK9mb0kYdmhL5Np38cvyKvS1ipANnDhX2p4A1p0Exddb l8GZoAYABJABgUc2Dxse7F77TVYpEZLvWYZYGZCfRL6RQGCRw/YMyPGgY4dInZmx3tjQ wjFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=qPGNZc3586GivLruWqE7INNBHJxnioSHwaPotAfVv78=; b=XZmIbBmDGVIz1nfOeEBBW7LJ0vAID/SazcH0LrzqozJaat52PZnawdGY59JbhpHFbu ekSLU+geyoa/gMjy7/Ye7OsbL69RkpyDkvbq0HBcvsn1wk+ZSaDvjHDWXH09Ff3QI3qz FEMxuQWplRa8D6UPxO+LZhc9D9qTtg8clXjDvhnFu0a/KGix+TFQs32iPHs7FEOc6LSU Jdw1iE7u87xypTLdNLIYLsyA2zbm2o8UHQdzvkgIHzp3CphAsoDjTnKjPyAsTNJMZoa+ bZf/TAnQ8YBWUUETGuW5pHO+xFJ0We7nwc7mQfOk10Q7rBnpgRi7RV+MHCPcglD9tHPq pRYw== X-Gm-Message-State: AKaTC01GiwlL8So3Yz1I55rfZj7a3qe5dTxqE36KuFC9tdV6FdaHAb0IPG/0td+OFUFILJgUJM0cCyymWk4gDg== X-Received: by 10.25.21.205 with SMTP id 74mr4355266lfv.138.1479818058150; Tue, 22 Nov 2016 04:34:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.137.4 with HTTP; Tue, 22 Nov 2016 04:33:47 -0800 (PST) In-Reply-To: References: From: Fabian Hueske Date: Tue, 22 Nov 2016 13:33:47 +0100 Message-ID: Subject: Re: [DISCUSS] Hold copies in HeapStateBackend To: "dev@flink.apache.org" Content-Type: multipart/alternative; boundary=001a11408008b03fec0541e2fd19 archived-at: Tue, 22 Nov 2016 12:36:29 -0000 --001a11408008b03fec0541e2fd19 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Does anybody have objections against copying the first record that goes into the ReduceState? 2016-11-22 12:49 GMT+01:00 Aljoscha Krettek : > That's right, yes. > > On Mon, 21 Nov 2016 at 19:14 Fabian Hueske wrote: > > > Right, but that would be a much bigger change than "just" copying the > > *first* record that goes into the ReduceState, or am I missing somethin= g? > > > > > > 2016-11-21 18:41 GMT+01:00 Aljoscha Krettek : > > > > > To bring over my comment from the Github PR that started this > discussion: > > > > > > @wuchong , yes this is a problem with the > > > HeapStateBackend. The RocksDB backend does not suffer from this > problem. > > I > > > think in the long run we should migrate the HeapStateBackend to alway= s > > keep > > > data in serialised form, then we also won't have this problem anymore= . > > > > > > So I'm very much in favour of keeping data serialised. Copying data > would > > > only ever be a stopgap solution. > > > > > > On Mon, 21 Nov 2016 at 15:56 Fabian Hueske wrote: > > > > > > > Another approach that would solve the problem for our use case > (object > > > > re-usage for incremental window ReduceFunctions) would be to copy t= he > > > first > > > > object that is put into the state. > > > > This would be a change on the ReduceState, not on the overall state > > > > backend, which should be feasible, no? > > > > > > > > > > > > > > > > 2016-11-21 15:43 GMT+01:00 Stephan Ewen : > > > > > > > > > -1 for copying objects. > > > > > > > > > > Storing a serialized data where possible is good, but copying all > > > objects > > > > > by default is not a good idea, in my opinion. > > > > > A lot of scenarios use data types that are hellishly expensive to > > copy. > > > > > Even the current copy on chain handover is a problem. > > > > > > > > > > Let's not introduce even more copies. > > > > > > > > > > On Mon, Nov 21, 2016 at 3:16 PM, Maciek Pr=C3=B3chniak > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > it will come with performance overhead when updating the state, > > but I > > > > > > think it'll be possible to perform asynchronous snapshots using > > > > > > HeapStateBackend (probably some changes to underlying data > > structures > > > > > would > > > > > > be needed) - which would bring more predictable performance. > > > > > > > > > > > > thanks, > > > > > > maciek > > > > > > > > > > > > > > > > > > On 21/11/2016 13:48, Aljoscha Krettek wrote: > > > > > > > > > > > >> Hi, > > > > > >> I would be in favour of this since it brings things in line wi= th > > the > > > > > >> RocksDB backend. This will, however, come with quite the > > performance > > > > > >> overhead, depending on how fast the TypeSerializer can copy. > > > > > >> > > > > > >> Cheers, > > > > > >> Aljoscha > > > > > >> > > > > > >> On Mon, 21 Nov 2016 at 11:30 Fabian Hueske > > > wrote: > > > > > >> > > > > > >> Hi everybody, > > > > > >>> > > > > > >>> when implementing a ReduceFunction for incremental aggregatio= n > of > > > > SQL / > > > > > >>> Table API window aggregates we noticed that the > HeapStateBackend > > > does > > > > > not > > > > > >>> store copies but holds references to the original objects. In > > case > > > > of a > > > > > >>> SlidingWindow, the same object is referenced from different > > window > > > > > panes. > > > > > >>> Therefore, it is not possible to modify these objects (in ord= er > > to > > > > > avoid > > > > > >>> object instantiations, see discussion [1]). > > > > > >>> > > > > > >>> Other state backends serialize their data such that the > behavior > > is > > > > not > > > > > >>> consistent across backends. > > > > > >>> If we want to have light-weight tests, we have to create new > > > objects > > > > in > > > > > >>> the > > > > > >>> ReduceFunction causing unnecessary overhead. > > > > > >>> > > > > > >>> I would propose to copy objects when storing them in a > > > > > HeapStateBackend. > > > > > >>> This would ensure that objects returned from state to the use= r > > > behave > > > > > >>> identical for different state backends. > > > > > >>> > > > > > >>> We created a related JIRA [2] that asks to copy records that = go > > > into > > > > an > > > > > >>> incremental ReduceFunction. The scope is more narrow and woul= d > > > solve > > > > > our > > > > > >>> problem, but would leave the inconsistent behavior of state > > > backends > > > > in > > > > > >>> place. > > > > > >>> > > > > > >>> What do others think? > > > > > >>> > > > > > >>> Cheers, Fabian > > > > > >>> > > > > > >>> [1] > > https://github.com/apache/flink/pull/2792#discussion_r88653721 > > > > > >>> [2] https://issues.apache.org/jira/browse/FLINK-5105 > > > > > >>> > > > > > >>> > > > > > > > > > > > > > > > > > > > > > --001a11408008b03fec0541e2fd19--