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 50DC3200D14 for ; Tue, 19 Sep 2017 02:24:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4F4211609DE; Tue, 19 Sep 2017 00:24:34 +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 6B09F1609DB for ; Tue, 19 Sep 2017 02:24:33 +0200 (CEST) Received: (qmail 25879 invoked by uid 500); 19 Sep 2017 00:24:27 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@flink.apache.org Received: (qmail 25869 invoked by uid 99); 19 Sep 2017 00:24:27 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Sep 2017 00:24:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E61E3C9065 for ; Tue, 19 Sep 2017 00:24:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 4mVOjJMaUI2T for ; Tue, 19 Sep 2017 00:24:22 +0000 (UTC) Received: from mandala.kddilabs.jp (mandala.kddilabs.jp [192.26.91.6]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 3DC825F4E5 for ; Tue, 19 Sep 2017 00:24:22 +0000 (UTC) Received: from localhost (mandala.kddilabs.jp [127.0.0.1]) by mandala.kddilabs.jp (Postfix) with ESMTP id E013A1DC025B; Tue, 19 Sep 2017 09:24:14 +0900 (JST) X-Virus-Scanned: amavisd-new at kddilabs.jp Received: from mandala.kddilabs.jp ([127.0.0.1]) by localhost (mandala.kddilabs.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t_eDU8CvxBb8; Tue, 19 Sep 2017 09:24:14 +0900 (JST) Received: from safeattach.localdomain (unknown [IPv6:2001:200:601:1a00:20c:29ff:fe79:2280]) by mandala.kddilabs.jp (Postfix) with ESMTP id 4E3D81DC0253; Tue, 19 Sep 2017 09:24:14 +0900 (JST) Received: from [172.19.124.199] (dhcp199.west-4f.cn.kddilabs.jp [172.19.124.199]) by safeattach.localdomain with ESMTP id v8J0ODr3008065; Tue, 19 Sep 2017 09:24:13 +0900 Subject: Re: Streaming API has a long delay at the beginning of the process. To: Fabian Hueske Cc: Till Rohrmann , user , ke-kurosawa@kddi-research.jp, ta-ogawara@kddi-research.jp, Takeshi Kitahara References: <8f88c5ed-2e33-ceee-3f4e-b99ca1b2f635@kddi-research.jp> <5727a1df-6bb3-2705-1093-4fbadc4a97a7@kddi-research.jp> <1b0b280f-b01b-2597-d16b-30b464fb07b7@kddi-research.jp> From: Yuta Morisawa Message-ID: <58128003-a527-e5a8-addc-7fcd27768a42@kddi-research.jp> Date: Tue, 19 Sep 2017 09:24:14 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit archived-at: Tue, 19 Sep 2017 00:24:34 -0000 Hi Fabian, Thanks a lot. I got a better understanding. > Operators are never GC'd (unless a job was cancelled) That's great information. Maybe, this is related to so called Managed Memory. The document will be better if detail documents about Memory Management exists. Thank you, Yuta On 2017/09/18 18:03, Fabian Hueske wrote: > Hi Yuta, > > you got most things right :-) > > 3) sources (such as Kafka connectors) are also considered operators and > start immediately because they are sources. > 4) All other operators start when they need to process their first > record. Operators are never GC'd (unless a job was cancelled), so the > setup cost is a one time thing that only happens when the job is started. > > Best, Fabian > > 2017-09-15 12:43 GMT+02:00 Yuta Morisawa >: > > Hi Fabian, > > Thank you for your description. > > This is my understanding. > 1, At the exact time execute() method called, Flink creates > JobGraph, submit it to JobManager, deploy tasks to TaskManagers and > DOES NOT execute each operators. > 2, Operators are executed when they needed. > 3, Sources(kafka-connectors) starts before operators. > 4, The first time operators are called or after GC removes > operators' instance, a kind of initialization occurs, such as > classloading, instantiation, memory allocation and so on. It may > costs much time. > > If there is any misunderstanding, please comment it. > If not, my question is solved. > > Regards. > Yuta > > On 2017/09/15 17:05, Fabian Hueske wrote: > > Hi Yuta, > > when the execute() method is called, the a so-called JobGraph is > constructed from all operators that have been added before by > calling map(), keyBy() and so on. > The JobGraph is then submitted to the JobManager which is the > master process in Flink. Based on the JobGraph, the master > deploys tasks to the worker processes (TaskManagers). > These are the tasks that do the actual processing and they are > subsequently started as I explained before, i.e., the source > task starts consuming from Kafka before subsequent tasks have > been started. > > So, there is quite a lot happening when you call execute() > including network communication and task deployment. > > Hope this helps, > Fabian > > 2017-09-15 4:25 GMT+02:00 Yuta Morisawa > > >>: > > >     Hi, Fabian > >     > If I understand you correctly, the problem is only for > the first events >     > that are processed. >     Yes. More Precisely, first 300 kafka-messages. > >     > AFAIK, Flink lazily instantiates its operators which > means that a source >     > task starts to consume records from Kafka before the > subsequent tasks >     > have been started. >     That's a great indication. It describe well the affair. >     But, according to the document, it says "The operations are > actually >     executed when the execution is explicitly triggered by an > execute() >     call on the execution environment.". >     What does it mean? >     AFAIK, common Flink programs invoke execute() in main(). >     Every operators start at this time? I think maybe no. > >     - Flink Document > > https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/api_concepts.html#lazy-evaluation > > > > > > >     > Not sure if or what can be done about this behavior. >     > I'll loop in Till who knows more about the lifecycle of > tasks. >     Thank you very much for your kindness. > >     Regards, Yuta > >     On 2017/09/14 19:32, Fabian Hueske wrote: > >         Hi, > >         If I understand you correctly, the problem is only for > the first >         events that are processed. > >         AFAIK, Flink lazily instantiates its operators which > means that >         a source task starts to consume records from Kafka > before the >         subsequent tasks have been started. >         That's why the latency of the first records is higher. > >         Not sure if or what can be done about this behavior. >         I'll loop in Till who knows more about the lifecycle of > tasks. > >         Best, Fabian > > >         2017-09-12 11:02 GMT+02:00 Yuta Morisawa >         >         > >         >         >>>: > >              Hi, > >              I am worrying about the delay of the Streaming API. >              My application is that it gets data from > kafka-connectors and >              process them, then push data to kafka-producers. >              The problem is that the app suffers a long delay > when the >         first data >              come in the cluster. >              It takes about 1000ms to process data (I measure > the time with >              kafka-timestamp). On the other hand, it works well > after >         2-3 seconds >              first data come in (the delay is about 200ms). > >              The application is so delay sensitive that I want > to solve >         this problem. >              Now, I think this is a matter of JVM but I have no > idea to >              investigate it. >              Is there any way to avoid this delay? > > > >              Thank you for your attention >              Yuta > > > >