Return-Path: X-Original-To: apmail-incubator-flume-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-flume-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FF268C4A for ; Tue, 16 Aug 2011 18:54:26 +0000 (UTC) Received: (qmail 1717 invoked by uid 500); 16 Aug 2011 18:54:26 -0000 Delivered-To: apmail-incubator-flume-user-archive@incubator.apache.org Received: (qmail 1618 invoked by uid 500); 16 Aug 2011 18:54:25 -0000 Mailing-List: contact flume-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flume-user@incubator.apache.org Delivered-To: mailing list flume-user@incubator.apache.org Received: (qmail 1605 invoked by uid 99); 16 Aug 2011 18:54:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 18:54:25 +0000 X-ASF-Spam-Status: No, hits=1.9 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mjlai09@gmail.com designates 209.85.216.47 as permitted sender) Received: from [209.85.216.47] (HELO mail-qw0-f47.google.com) (209.85.216.47) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 18:54:15 +0000 Received: by qwh5 with SMTP id 5so129681qwh.6 for ; Tue, 16 Aug 2011 11:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=vN+LuFGHIfowFhfwf060IU9j7aP9kbmWiMekgOEhSBw=; b=khjJWQ9VbTM50U/cDRASbBXVzQHyJRgjW62RFAfI/DK0xk62g5kv9pU13Yqe0kidQ1 pCpuHm8E3ruO5LGL0xZCz1FwLUqLEmpEqB3rXCHqNhPIxTGzbEpcyDmjT85szHvoJ3hE /UjUSTfm3D1FyKlBEsBFkoGCM946cpsTFmyE4= Received: by 10.224.27.13 with SMTP id g13mr82678qac.174.1313520834880; Tue, 16 Aug 2011 11:53:54 -0700 (PDT) Received: from [10.52.44.34] ([216.207.36.222]) by mx.google.com with ESMTPS id fq5sm90181qab.15.2011.08.16.11.53.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Aug 2011 11:53:53 -0700 (PDT) Message-ID: <4E4ABCC0.1090502@googlemail.com> Date: Tue, 16 Aug 2011 11:53:52 -0700 From: Mingjie Lai User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: flume-user@incubator.apache.org Subject: Re: buffered sink decorator practices References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Joe. I have a similar case that I need to accumulate some data at a decorator and write to a sink in a batch. 1) is a reasonable choice. But I don't think deriving from BatchingDecorator be a good idea. For my case, there is little in common from the class. Why not borrowing the idea and implementing yours version? For 2), I don't like the idea to call append() in a separate thread. (if I understand your solution correctly.) Thanks, Mingjie On 08/16/2011 07:46 AM, Joe Crobak wrote: > Since I've spent some time working on this, I thought I'd share my > findings and reiterate a question below. > > On Wed, Aug 10, 2011 at 10:46 AM, Joe Crobak > wrote: > > We've written a simple sink decorator to do in-memory aggregations. > Currently, we're using a roll sink to cause the aggregator > decorator to be closed/reopened ever 60 seconds. Based upon the > info in [1], by default the close() operation has 30 seconds to > complete. We're seeing this fail in some cases due to other > bottlenecks. I'm hesitant to just up the timeout, though, since long > GCs or other events could cause the problem regardless of the timeout. > > With all this in mind, I have two questions. > 1) Rollsink and BatchingDecorator seem to share a lot of similar > logic to run a background thread to flush events periodically. There > seems to be a lot of subtly in these implementations to avoid > deadlocks. Are either of these suitable for subclassing? (I guess > BatchingDecorator is closer to what I'm looking for)... has anyone > ever done this before? > > > I tried to subclass BatchingDecorator, but it didn't quite work. I need > access to BatchingDecorator's super-classes' append() method. I suspect > it might be useful to expose an abstract class with the core-logic of > time-based and count-based "batching" -- or am I the only one with this > problem? If others are interested, I could start a patch. > > 2) It's possible for our sink decorator to generate more events than > it receives, so I am afraid it could become behind -- are there > dangers in using a threadpool to call append() from a decorator to > forward events to the collector? > > > I'm still wondering if a decorator might call through to its sink with a > background threadpool. Any thoughts about whether this is a > good/bad/terrible idea? > > Thanks, > Joe >