From issues-return-149783-archive-asf-public=cust-asf.ponee.io@flink.apache.org Fri Jan 26 18:11:04 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8A096180676 for ; Fri, 26 Jan 2018 18:11:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 79EB9160C20; Fri, 26 Jan 2018 17:11:04 +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 C9760160C3E for ; Fri, 26 Jan 2018 18:11:03 +0100 (CET) Received: (qmail 18725 invoked by uid 500); 26 Jan 2018 17:11:03 -0000 Mailing-List: contact issues-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 issues@flink.apache.org Received: (qmail 18714 invoked by uid 99); 26 Jan 2018 17:11:03 -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; Fri, 26 Jan 2018 17:11:02 +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 759521A01A2 for ; Fri, 26 Jan 2018 17:11:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -102.311 X-Spam-Level: X-Spam-Status: No, score=-102.311 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Xwi7YrZ5WgoX for ; Fri, 26 Jan 2018 17:11:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 1150460D3D for ; Fri, 26 Jan 2018 17:11:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A4F9BE0F37 for ; Fri, 26 Jan 2018 17:11:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 667D2240FA for ; Fri, 26 Jan 2018 17:11:00 +0000 (UTC) Date: Fri, 26 Jan 2018 17:11:00 +0000 (UTC) From: "Stefan Richter (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-3089) State API Should Support Data Expiration (State TTL) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-3089?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1634= 1298#comment-16341298 ]=20 Stefan Richter commented on FLINK-3089: --------------------------------------- [~phoenixjiangnan] I agree that we could start with a relaxed TTL approach.= I would not limit the feature to RocksDB, in fact I am also considering to= implement incremental snapshot for the heap backend and have some=C2=A0app= roach=C2=A0how to this could be done. For TTL on the heap backend, I also have some ideas how=C2=A0this could=C2= =A0work for the async variant (see `CopyOnWriteStateTable` which is the def= ault since 1.4 and might become the only implementation eventually). For ex= ample, one idea is that we might go for an approach that works similar to t= he incremental rehash: doing a linear scan over the directory that removes = outdated entries over time. This scan is performed in very small steps and = driven by other operations,=C2=A0 e.g.=C2=A0a small fraction of the buckets= (maybe just one) is cleaned up as side=C2=A0activity=C2=A0for every operat= ion on the map to amortize the cleanup costs.=C2=A0With=C2=A0the linear nat= ure, =C2=A0at least those accesses to the bucket array are also cache consc= ious. In general, outdated entries cound be detected by an attached timesta= mp (introducing more memory overhead per entry), or we could try to correla= te timeout with the state version that already exists on every entry in thi= s map. > State API Should Support Data Expiration (State TTL) > ---------------------------------------------------- > > Key: FLINK-3089 > URL: https://issues.apache.org/jira/browse/FLINK-3089 > Project: Flink > Issue Type: New Feature > Components: DataStream API, State Backends, Checkpointing > Reporter: Niels Basjes > Assignee: Bowen Li > Priority: Major > > In some usecases (webanalytics) there is a need to have a state per visit= or on a website (i.e. keyBy(sessionid) ). > At some point the visitor simply leaves and no longer creates new events = (so a special 'end of session' event will not occur). > The only way to determine that a visitor has left is by choosing a timeou= t, like "After 30 minutes no events we consider the visitor 'gone'". > Only after this (chosen) timeout has expired should we discard this state= . > In the Trigger part of Windows we can set a timer and close/discard this = kind of information. But that introduces the buffering effect of the window= (which in some scenarios is unwanted). > What I would like is to be able to set a timeout on a specific state whic= h I can update afterwards. > This makes it possible to create a map function that assigns the right va= lue and that discards the state automatically. -- This message was sent by Atlassian JIRA (v7.6.3#76005)