From user-return-1431-archive-asf-public=cust-asf.ponee.io@kudu.apache.org Mon Jul 23 16:21:46 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A52DA180647 for ; Mon, 23 Jul 2018 16:21:44 +0200 (CEST) Received: (qmail 58294 invoked by uid 500); 23 Jul 2018 14:21:43 -0000 Mailing-List: contact user-help@kudu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@kudu.apache.org Delivered-To: mailing list user@kudu.apache.org Received: (qmail 58284 invoked by uid 99); 23 Jul 2018 14:21:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2018 14:21:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 82AE4C0354 for ; Mon, 23 Jul 2018 14:21:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.209 X-Spam-Level: * X-Spam-Status: No, score=1.209 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_LOW=-0.7, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=boristyukin.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 2XLuj65lOOqp for ; Mon, 23 Jul 2018 14:21:36 +0000 (UTC) Received: from mx36-out26.antispamcloud.com (mx36-out26.antispamcloud.com [209.126.121.74]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 680FA5F27E for ; Mon, 23 Jul 2018 14:21:35 +0000 (UTC) Received: from s2.fcomet.com ([99.198.101.250]) by mx65.antispamcloud.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fhbiH-00039O-H5 for user@kudu.apache.org; Mon, 23 Jul 2018 16:21:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=boristyukin.com; s=default; h=Content-Type:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=03T/aVVrCF4HPWLlpJAL3fTfC/gtx9PKQHAtb4wN5tw=; b=xjJQ50M1JFvNFct4YFACXF3QF 34d/U+3/7DoyyFlFNPIpVzcO+KAf+ZOV6VBo85zJgd4oCVI+olTSX3zSy/J9Ua4BYnm/UB7GowoLh fGj21XKe0ElP7Szn4h+oL+MfZvBuB6aQCRtdZN1z/qsAWvR1LofYqsEFYndgPBGj+fMZ0=; Received: from mail-it0-f48.google.com ([209.85.214.48]:39002) by s2.fcomet.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1fhbhZ-006ezc-CM for user@kudu.apache.org; Mon, 23 Jul 2018 09:20:41 -0500 Received: by mail-it0-f48.google.com with SMTP id g141-v6so1506303ita.4 for ; Mon, 23 Jul 2018 07:20:42 -0700 (PDT) X-Gm-Message-State: AOUpUlHQUhzvaoMzmvT8xRo8lUn2Epjg+wmCssW1fVcn0XNpFUOs5U/3 mzw69wEV8kq4dPcszYDfDygtVwyAvSa38UqZqCE= X-Google-Smtp-Source: AAOMgpdp4J+GQaWfwIiBFU/57SdHN4ho66b7STCBaNi4jHCygjVlqZB9ksV96sFXaUIu2FIYCwjFaDeONcqvCbbPi3s= X-Received: by 2002:a24:7414:: with SMTP id o20-v6mr3531577itc.116.1532355641782; Mon, 23 Jul 2018 07:20:41 -0700 (PDT) MIME-Version: 1.0 References: <1BEF1E38-2AA2-4CF0-B9B5-CD138C166E80@mediamath.com> In-Reply-To: From: Boris Tyukin Date: Mon, 23 Jul 2018 10:20:05 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: "broadcast" tablet replication for kudu? To: user@kudu.apache.org Content-Type: multipart/alternative; boundary="000000000000b2b7120571ab5983" X-AuthUser: boris@boristyukin.com X-Originating-IP: 99.198.101.250 X-AntiSpamCloud-Domain: s2.fcomet.com X-AntiSpamCloud-Username: 99.198.101.250 Authentication-Results: antispamcloud.com; auth=pass smtp.auth=99.198.101.250@s2.fcomet.com X-AntiSpamCloud-Outgoing-Class: unsure X-AntiSpamCloud-Outgoing-Evidence: Combined (0.25) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5tmkyHX8g7qf/PpBb+EQfdR602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO2HFEYQDlNqPthodLGs7Ym7sT+bYMn6GaM87VISxooGyHEIa1HEPqnHrPNwkLBhwbwzL /r9lEJQo+/x8oh4sIaVQyacT2UA9FxLvxR5esQOY4yfYt/aZYxKF8vvJTd2IxVYFvf25LVONYbYi fH5OzZBcL+MdujCjU5iV47di8pZymqZ9l5BbLgn5uBWKsF5sXv6uW3BB9i/rD4I2O09txq7iTzj+ /BOqg7SFB7Og72Wa0TyXe6jsMXnTy/o9BuCfMYsBbhD/tHT750Dm5PISDrPwasZygQptvhq3qMbc wbMUNbkoN+8KDM9EVb2Q67FfC2FiLICbocycVEwfZcQzfhqfvVTIQCZJhFYNqRiUAmoAxySwKIPs YaBNUjbYktP7HHpRgAE8QmaiSAxWIQ3rF5XnHD7UkZNJv5ELd+fE0H2a2OUMeHyTpNN0eXybX/w7 /0Z1MG11dQo787pazOh1MNb7dzMtw/Qiib4x+Bl6ifIiHL0uDcPM4Nv+HETr6+9B0hTmp9rbarxg sPZHGEdgOoLJiK2S1G2lVnAlp4On+QvMhXzs9FupW/ftTHvPtj7uvGwv1myk5o1QGE67S44hqNDW P2kQlLrvRVjS3MLA4yC7JOIA9c2OES56iejdS6raq1tndM5BrTpER6KEGGhC/EPTf8xnIe/TOKJw SaEhoW2jK/ZZmLchcWr09WyigYIfZjiGqbnQtp+Uru2O4RxzJLVwrsEy/9IyXmfciOOsbJlHw6nI oDr0sXUZ7YZoZ/GZ+nQ3yqhKk70x60dcH3CZX2+O20An29iPw6Orl/plMKI1jSn4s0+TiI+iXrUe VPMKD1YFvf25LVONYbYifH5OzZDQiFYmAKLUjk2kfJjtsLrZqU4xq9/6BtduJAab3BG6KTZ/CUZQ GNWCJBAlRN4WAyw= X-Report-Abuse-To: spam@quarantine1.antispamcloud.com --000000000000b2b7120571ab5983 Content-Type: text/plain; charset="UTF-8" Hi Todd, Are you saying that your earlier comment below is not longer valid with Impala 2.11 and if I replicate a table to all our Kudu nodes Impala can benefit from this? " *It's worth noting that, even if your table is replicated, Impala's planner is unaware of this fact and it will give the same plan regardless. That is to say, rather than every node scanning its local copy, instead a single node will perform the whole scan (assuming it's a small table) and broadcast it from there within the scope of a single query. So, I don't think you'll see any performance improvements on Impala queries by attempting something like an extremely high replication count.* *I could see bumping the replication count to 5 for these tables since the extra storage cost is low and it will ensure higher availability of the important central tables, but I'd be surprised if there is any measurable perf impact.* " On Mon, Jul 23, 2018 at 9:46 AM Todd Lipcon wrote: > Are you on the latest release of Impala? It switched from using Thrift for > RPC to a new implementation (actually borrowed from kudu) which might help > broadcast performance a bit. > > Todd > > On Mon, Jul 23, 2018, 6:43 AM Boris Tyukin wrote: > >> sorry to revive the old thread but I am curious if there is a good way to >> speed up requests to frequently used tables in Kudu. >> >> On Thu, Apr 12, 2018 at 8:19 AM Boris Tyukin >> wrote: >> >>> bummer..After reading your guys conversation, I wish there was an easier >>> way...we will have the same issue as we have a few dozens of tables which >>> are used very frequently in joins and I was hoping there was an easy way to >>> replicate them on most of the nodes to avoid broadcasts every time >>> >>> On Thu, Apr 12, 2018 at 7:26 AM, Clifford Resnick < >>> cresnick@mediamath.com> wrote: >>> >>>> The table in our case is 12x hashed and ranged by month, so the >>>> broadcasts were often to all (12) nodes. >>>> >>>> On Apr 12, 2018 12:58 AM, Mauricio Aristizabal >>>> wrote: >>>> Sorry I left that out Cliff, FWIW it does seem to have been broadcast.. >>>> >>>> >>>> >>>> Not sure though how a shuffle would be much different from a broadcast >>>> if entire table is 1 file/block in 1 node. >>>> >>>> On Wed, Apr 11, 2018 at 8:52 PM, Cliff Resnick >>>> wrote: >>>> >>>>> From the screenshot it does not look like there was a broadcast of the >>>>> dimension table(s), so it could be the case here that the multiple smaller >>>>> sends helps. Our dim tables are generally in the single-digit millions and >>>>> Impala chooses to broadcast them. Since the fact result cardinality is >>>>> always much smaller, we've found that forcing a [shuffle] dimension join is >>>>> actually faster since it only sends dims once rather than all to all nodes. >>>>> The degenerative performance of broadcast is especially obvious when the >>>>> query returns zero results. I don't have much experience here, but it does >>>>> seem that Kudu's efficient predicate scans can sometimes "break" Impala's >>>>> query plan. >>>>> >>>>> -Cliff >>>>> >>>>> On Wed, Apr 11, 2018 at 5:41 PM, Mauricio Aristizabal < >>>>> mauricio@impact.com> wrote: >>>>> >>>>>> @Todd not to belabor the point, but when I suggested breaking up >>>>>> small dim tables into multiple parquet files (and in this thread's context >>>>>> perhaps partition kudu table, even if small, into multiple tablets), it was >>>>>> to speed up joins/exchanges, not to parallelize the scan. >>>>>> >>>>>> For example recently we ran into this slow query where the 14M record >>>>>> dimension fit into a single file & block, so it got scanned on a single >>>>>> node though still pretty quickly (300ms), however it caused the join to >>>>>> take 25+ seconds and bogged down the entire query. See highlighted >>>>>> fragment and its parent. >>>>>> >>>>>> So we broke it into several small files the way I described in my >>>>>> previous post, and now join and query are fast (6s). >>>>>> >>>>>> -m >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Fri, Mar 16, 2018 at 3:55 PM, Todd Lipcon >>>>>> wrote: >>>>>> >>>>>>> I suppose in the case that the dimension table scan makes a >>>>>>> non-trivial portion of your workload time, then yea, parallelizing the scan >>>>>>> as you suggest would be beneficial. That said, in typical analytic queries, >>>>>>> scanning the dimension tables is very quick compared to scanning the >>>>>>> much-larger fact tables, so the extra parallelism on the dim table scan >>>>>>> isn't worth too much. >>>>>>> >>>>>>> -Todd >>>>>>> >>>>>>> On Fri, Mar 16, 2018 at 2:56 PM, Mauricio Aristizabal < >>>>>>> mauricio@impactradius.com> wrote: >>>>>>> >>>>>>>> @Todd I know working with parquet in the past I've seen small >>>>>>>> dimensions that fit in 1 single file/block limit parallelism of >>>>>>>> join/exchange/aggregation nodes, and I've forced those dims to spread >>>>>>>> across 20 or so blocks by leveraging SET PARQUET_FILE_SIZE=8m; or similar >>>>>>>> when doing INSERT OVERWRITE to load them, which then allows these >>>>>>>> operations to parallelize across that many nodes. >>>>>>>> >>>>>>>> Wouldn't it be useful here for Cliff's small dims to be partitioned >>>>>>>> into a couple tablets to similarly improve parallelism? >>>>>>>> >>>>>>>> -m >>>>>>>> >>>>>>>> On Fri, Mar 16, 2018 at 2:29 PM, Todd Lipcon >>>>>>>> wrote: >>>>>>>> >>>>>>>>> On Fri, Mar 16, 2018 at 2:19 PM, Cliff Resnick >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hey Todd, >>>>>>>>>> >>>>>>>>>> Thanks for that explanation, as well as all the great work you're >>>>>>>>>> doing -- it's much appreciated! I just have one last follow-up question. >>>>>>>>>> Reading about BROADCAST operations (Kudu, Spark, Flink, etc. ) it seems the >>>>>>>>>> smaller table is always copied in its entirety BEFORE the predicate is >>>>>>>>>> evaluated. >>>>>>>>>> >>>>>>>>> >>>>>>>>> That's not quite true. If you have a predicate on a joined column, >>>>>>>>> or on one of the columns in the joined table, it will be pushed down to the >>>>>>>>> "scan" operator, which happens before the "exchange". In addition, there is >>>>>>>>> a feature called "runtime filters" that can push dynamically-generated >>>>>>>>> filters from one side of the exchange to the other. >>>>>>>>> >>>>>>>>> >>>>>>>>>> But since the Kudu client provides a serialized scanner as part >>>>>>>>>> of the ScanToken API, why wouldn't Impala use that instead if it knows that >>>>>>>>>> the table is Kudu and the query has any type of predicate? Perhaps if I >>>>>>>>>> hash-partition the table I could maybe force this (because that complicates >>>>>>>>>> a BROADCAST)? I guess this is really a question for Impala but perhaps >>>>>>>>>> there is a more basic reason. >>>>>>>>>> >>>>>>>>> >>>>>>>>> Impala could definitely be smarter, just a matter of programming >>>>>>>>> Kudu-specific join strategies into the optimizer. Today, the optimizer >>>>>>>>> isn't aware of the unique properties of Kudu scans vs other storage >>>>>>>>> mechanisms. >>>>>>>>> >>>>>>>>> -Todd >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> -Cliff >>>>>>>>>> >>>>>>>>>> On Fri, Mar 16, 2018 at 4:10 PM, Todd Lipcon >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>>> On Fri, Mar 16, 2018 at 12:30 PM, Clifford Resnick < >>>>>>>>>>> cresnick@mediamath.com> wrote: >>>>>>>>>>> >>>>>>>>>>>> I thought I had read that the Kudu client can configure a scan >>>>>>>>>>>> for CLOSEST_REPLICA and assumed this was a way to take advantage of data >>>>>>>>>>>> collocation. >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Yea, when a client uses CLOSEST_REPLICA it will read a local one >>>>>>>>>>> if available. However, that doesn't influence the higher level operation of >>>>>>>>>>> the Impala (or Spark) planner. The planner isn't aware of the replication >>>>>>>>>>> policy, so it will use one of the existing supported JOIN strategies. Given >>>>>>>>>>> statistics, it will choose to broadcast the small table, which means that >>>>>>>>>>> it will create a plan that looks like: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> +-------------------------+ >>>>>>>>>>> | | >>>>>>>>>>> +---------->build JOIN | >>>>>>>>>>> | | | >>>>>>>>>>> | | probe | >>>>>>>>>>> +--------------+ +-------------------------+ >>>>>>>>>>> | | | >>>>>>>>>>> | Exchange | | >>>>>>>>>>> +----+ (broadcast | | >>>>>>>>>>> | | | | >>>>>>>>>>> | +--------------+ | >>>>>>>>>>> | | >>>>>>>>>>> +---------+ | >>>>>>>>>>> | | >>>>>>>>>>> +-----------------------+ >>>>>>>>>>> | SCAN | | >>>>>>>>>>> | >>>>>>>>>>> | KUDU | | SCAN (other side) >>>>>>>>>>> | >>>>>>>>>>> | | | >>>>>>>>>>> | >>>>>>>>>>> +---------+ >>>>>>>>>>> +-----------------------+ >>>>>>>>>>> >>>>>>>>>>> (hopefully the ASCII art comes through) >>>>>>>>>>> >>>>>>>>>>> In other words, the "scan kudu" operator scans the table once, >>>>>>>>>>> and then replicates the results of that scan into the JOIN operator. The >>>>>>>>>>> "scan kudu" operator of course will read its local copy, but it will still >>>>>>>>>>> go through the exchange process. >>>>>>>>>>> >>>>>>>>>>> For the use case you're talking about, where the join is just >>>>>>>>>>> looking up a single row by PK in a dimension table, ideally we'd be using >>>>>>>>>>> an altogether different join strategy such as nested-loop join, with the >>>>>>>>>>> inner "loop" actually being a Kudu PK lookup, but that strategy isn't >>>>>>>>>>> implemented by Impala. >>>>>>>>>>> >>>>>>>>>>> -Todd >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> If this exists then how far out of context is my understanding >>>>>>>>>>>> of it? Reading about HDFS cache replication, I do know that Impala will >>>>>>>>>>>> choose a random replica there to more evenly distribute load. But >>>>>>>>>>>> especially compared to Kudu upsert, managing mutable data using Parquet is >>>>>>>>>>>> painful. So, perhaps to sum thing up, if nearly 100% of my metadata scan >>>>>>>>>>>> are single Primary Key lookups followed by a tiny broadcast then am I >>>>>>>>>>>> really just splitting hairs performance-wise between Kudu and HDFS-cached >>>>>>>>>>>> parquet? >>>>>>>>>>>> >>>>>>>>>>>> From: Todd Lipcon >>>>>>>>>>>> Reply-To: "user@kudu.apache.org" >>>>>>>>>>>> Date: Friday, March 16, 2018 at 2:51 PM >>>>>>>>>>>> >>>>>>>>>>>> To: "user@kudu.apache.org" >>>>>>>>>>>> Subject: Re: "broadcast" tablet replication for kudu? >>>>>>>>>>>> >>>>>>>>>>>> It's worth noting that, even if your table is replicated, >>>>>>>>>>>> Impala's planner is unaware of this fact and it will give the same plan >>>>>>>>>>>> regardless. That is to say, rather than every node scanning its local copy, >>>>>>>>>>>> instead a single node will perform the whole scan (assuming it's a small >>>>>>>>>>>> table) and broadcast it from there within the scope of a single query. So, >>>>>>>>>>>> I don't think you'll see any performance improvements on Impala queries by >>>>>>>>>>>> attempting something like an extremely high replication count. >>>>>>>>>>>> >>>>>>>>>>>> I could see bumping the replication count to 5 for these tables >>>>>>>>>>>> since the extra storage cost is low and it will ensure higher availability >>>>>>>>>>>> of the important central tables, but I'd be surprised if there is any >>>>>>>>>>>> measurable perf impact. >>>>>>>>>>>> >>>>>>>>>>>> -Todd >>>>>>>>>>>> >>>>>>>>>>>> On Fri, Mar 16, 2018 at 11:35 AM, Clifford Resnick < >>>>>>>>>>>> cresnick@mediamath.com> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Thanks for that, glad I was wrong there! Aside from >>>>>>>>>>>>> replication considerations, is it also recommended the number of tablet >>>>>>>>>>>>> servers be odd? >>>>>>>>>>>>> >>>>>>>>>>>>> I will check forums as you suggested, but from what I read >>>>>>>>>>>>> after searching is that Impala relies on user configured caching strategies >>>>>>>>>>>>> using HDFS cache. The workload for these tables is very light write, maybe >>>>>>>>>>>>> a dozen or so records per hour across 6 or 7 tables. The size of the tables >>>>>>>>>>>>> ranges from thousands to low millions of rows so so sub-partitioning would >>>>>>>>>>>>> not be required. So perhaps this is not a typical use-case but I think it >>>>>>>>>>>>> could work quite well with kudu. >>>>>>>>>>>>> >>>>>>>>>>>>> From: Dan Burkert >>>>>>>>>>>>> Reply-To: "user@kudu.apache.org" >>>>>>>>>>>>> Date: Friday, March 16, 2018 at 2:09 PM >>>>>>>>>>>>> To: "user@kudu.apache.org" >>>>>>>>>>>>> Subject: Re: "broadcast" tablet replication for kudu? >>>>>>>>>>>>> >>>>>>>>>>>>> The replication count is the number of tablet servers which >>>>>>>>>>>>> Kudu will host copies on. So if you set the replication level to 5, Kudu >>>>>>>>>>>>> will put the data on 5 separate tablet servers. There's no built-in >>>>>>>>>>>>> broadcast table feature; upping the replication factor is the closest >>>>>>>>>>>>> thing. A couple of things to keep in mind: >>>>>>>>>>>>> >>>>>>>>>>>>> - Always use an odd replication count. This is important due >>>>>>>>>>>>> to how the Raft algorithm works. Recent versions of Kudu won't even let >>>>>>>>>>>>> you specify an even number without flipping some flags. >>>>>>>>>>>>> - We don't test much much beyond 5 replicas. It *should* >>>>>>>>>>>>> work, but you may run in to issues since it's a relatively rare >>>>>>>>>>>>> configuration. With a heavy write workload and many replicas you are even >>>>>>>>>>>>> more likely to encounter issues. >>>>>>>>>>>>> >>>>>>>>>>>>> It's also worth checking in an Impala forum whether it has >>>>>>>>>>>>> features that make joins against small broadcast tables better? Perhaps >>>>>>>>>>>>> Impala can cache small tables locally when doing joins. >>>>>>>>>>>>> >>>>>>>>>>>>> - Dan >>>>>>>>>>>>> >>>>>>>>>>>>> On Fri, Mar 16, 2018 at 10:55 AM, Clifford Resnick < >>>>>>>>>>>>> cresnick@mediamath.com> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> The problem is, AFIK, that replication count is not >>>>>>>>>>>>>> necessarily the distribution count, so you can't guarantee all tablet >>>>>>>>>>>>>> servers will have a copy. >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Mar 16, 2018 1:41 PM, Boris Tyukin >>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>> I'm new to Kudu but we are also going to use Impala mostly >>>>>>>>>>>>>> with Kudu. We have a few tables that are small but used a lot. My plan is >>>>>>>>>>>>>> replicate them more than 3 times. When you create a kudu table, you can >>>>>>>>>>>>>> specify number of replicated copies (3 by default) and I guess you can put >>>>>>>>>>>>>> there a number, corresponding to your node count in cluster. The downside, >>>>>>>>>>>>>> you cannot change that number unless you recreate a table. >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Fri, Mar 16, 2018 at 10:42 AM, Cliff Resnick < >>>>>>>>>>>>>> cresny@gmail.com> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>>> We will soon be moving our analytics from AWS Redshift to >>>>>>>>>>>>>>> Impala/Kudu. One Redshift feature that we will miss is its ALL >>>>>>>>>>>>>>> Distribution, where a copy of a table is maintained on each server. We >>>>>>>>>>>>>>> define a number of metadata tables this way since they are used in nearly >>>>>>>>>>>>>>> every query. We are considering using parquet in HDFS cache for these, and >>>>>>>>>>>>>>> Kudu would be a much better fit for the update semantics but we are worried >>>>>>>>>>>>>>> about the additional contention. I'm wondering if having a Broadcast, or >>>>>>>>>>>>>>> ALL, tablet replication might be an easy feature to add to Kudu? >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> -Cliff >>>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> Todd Lipcon >>>>>>>>>>>> Software Engineer, Cloudera >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> Todd Lipcon >>>>>>>>>>> Software Engineer, Cloudera >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Todd Lipcon >>>>>>>>> Software Engineer, Cloudera >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> *MAURICIO ARISTIZABAL* >>>>>>>> Architect - Business Intelligence + Data Science >>>>>>>> mauricio@impactradius.com(m)+1 323 309 4260 <(323)%20309-4260> >>>>>>>> 223 E. De La Guerra St. | Santa Barbara, CA 93101 >>>>>>>> >>>>>>>> >>>>>>>> Overview | Twitter >>>>>>>> | Facebook >>>>>>>> | >>>>>>>> LinkedIn >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Todd Lipcon >>>>>>> Software Engineer, Cloudera >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Mauricio Aristizabal >>>>>> Architect - Data Pipeline >>>>>> *M * 323 309 4260 >>>>>> *E *mauricio@impact.com | *W * https://impact.com >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> Mauricio Aristizabal >>>> Architect - Data Pipeline >>>> *M * 323 309 4260 >>>> *E *mauricio@impact.com | *W * https://impact.com >>>> >>>> >>>> >>>> >>> >>> --000000000000b2b7120571ab5983 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Todd,=C2=A0

Are you saying that your= earlier comment below is not longer valid with Impala 2.11 and if I replic= ate a table to all our Kudu nodes Impala can benefit from this?
<= br>
"

I could see bumping the repl= ication count to 5 for these tables since the extra storage cost is low and= it will ensure higher availability of the important central tables, but I&= #39;d be surprised if there is any measurable perf impact.
"<= /div>

On Mon, Jul 23, = 2018 at 9:46 AM Todd Lipcon <todd@c= loudera.com> wrote:
Are you on the latest release of Impala? It switched from using T= hrift for RPC to a new implementation (actually borrowed from kudu) which m= ight help broadcast performance a bit.

Todd

O= n Mon, Jul 23, 2018, 6:43 AM Boris Tyukin <boris@boristyukin.com> wrote:
sorry to revive the old th= read but I am curious if there is a good way to speed up requests to freque= ntly used tables in Kudu.

On Thu, Apr 12, 2018 at 8:19 AM Boris Tyukin <boris@boristyukin.c= om> wrote:
= bummer..After reading your guys conversation, I wish there was an easier wa= y...we will have the same issue as we have a few dozens of tables which are= used very frequently in joins and I was hoping there was an easy way to re= plicate them on most of the nodes to avoid broadcasts every time

On Thu, Apr 12, 2018 a= t 7:26 AM, Clifford Resnick <cresnick@mediamath.co= m> wrote:
The table in our case is 12x hashed and ranged by month, = so the broadcasts were often to all (12) nodes.

On Apr 12, 2018 12:58 AM, Mauricio Aristizabal &= lt;mauricio@impact.com> wrote:
Sorry I left that out Cliff, FWIW it does seem to have bee= n broadcast..



Not sure though how a shuffle would be much different from a broadcast= if entire table is 1 file/block in 1 node.

On Wed, Apr 11, 2018 at 8:52 PM, Cliff Resnick <= span dir=3D"ltr"> <cresny@gmail.com> wrote:
From the screenshot it does not=C2=A0look like there was a= broadcast of the dimension table(s), so it could be the case here that the= multiple smaller sends helps. Our dim tables are generally in the single-d= igit millions and Impala chooses to broadcast them. Since the fact result cardinality is always much smaller, we've = found that forcing a [shuffle] dimension join is actually faster since it o= nly sends dims once rather than all to all nodes. The degenerative performa= nce of broadcast is especially obvious when the query returns zero results. I don't have much experience here= , but it does seem that Kudu's efficient predicate scans can sometimes = "break" Impala's query plan.=

-Cliff

On Wed, Apr 11, 2018 at 5:41 PM, Mauricio Aristi= zabal <mauricio@impact.com> wrote:
@Todd not to belabor the point, but when I suggested break= ing up small dim tables into multiple parquet files (and in this thread'= ;s context perhaps partition kudu table, even if small, into multiple table= ts), it was to speed up joins/exchanges, not to parallelize the scan.=C2=A0=C2=A0

For example recently we ran into this slow query where the 14M record = dimension fit into a single file & block, so it got scanned on a single= node though still pretty quickly (300ms), however it caused the join to ta= ke 25+ seconds and bogged down the entire query.=C2=A0 See highlighted fragment and its parent.=C2=A0=C2=A0

So we broke it into several small files the way I described in my prev= ious post, and now join and query are fast (6s).=C2=A0

-m





On Fri, Mar 16, 2018 at 3:55 PM, Todd Lipcon <todd@cloudera.com> wrote:
I suppose in the case that the dimension table scan makes = a non-trivial portion of your workload time, then yea, parallelizing the sc= an as you suggest would be beneficial. That said, in typical analytic queri= es, scanning the dimension tables is very quick compared to scanning the much-larger fact tables, so the ext= ra parallelism on the dim table scan isn't worth too much.

-Todd

On Fri, Mar 16, 2018 at 2:56 PM, Mauricio Aristi= zabal <mauricio@impactradius.com> wrote:
@Todd I know working with parquet in the past I've see= n small dimensions that fit in 1 single file/block limit parallelism of joi= n/exchange/aggregation nodes, and I've forced those dims to spread acro= ss 20 or so blocks by leveraging SET PARQUET_FILE_SIZE=3D8m; or similar when doing INSERT OVERWRITE to load them, which then allows the= se operations to parallelize across that many nodes.

Wouldn't it be useful here for Cliff's small dims to be partit= ioned into a couple tablets to similarly improve parallelism?

-m

On Fri, Mar 16, 2018 at 2:29 PM, Todd Lipcon <todd@cloudera.com> wrote:
On Fri, Mar 16, 2018 at 2:19 PM, Cliff Res= nick <cresny@gmail.com> wrote:
Hey Todd,

Thanks for that explanation, as well as all the great work you're = doing=C2=A0 -- it's much appreciated! I just have one=C2=A0last follow-= up question. Reading about BROADCAST operations (Kudu, Spark, Flink, etc. )= it seems the smaller table is always copied in its entirety BEFORE the predicate is evaluated.

That's not quite true. If you have a predicate on a joined column,= or on one of the columns in the joined table, it will be pushed down to th= e "scan" operator, which happens before the "exchange".= In addition, there is a feature called "runtime filters" that can push dynamically-generated filters from one side of the exchange = to the other.
=C2=A0
But since the Kudu client provides a serialized scanner as part of the= ScanToken API, why wouldn't Impala use that instead if=C2=A0it knows t= hat the table is Kudu and the query has any type of predicate? Perhaps if I= hash-partition the table I could maybe force this (because that complicates a BROADCAST)? I guess this is really a ques= tion for Impala but perhaps there is a more basic reason.

Impala could definitely be smarter, just a matter of programming Kudu-= specific join strategies into the optimizer. Today, the optimizer isn't= aware of the unique properties of Kudu scans vs other storage mechanisms.<= /div>

-Todd
=C2=A0

-Cliff

On Fri, Mar 16, 2018 at 4:10 PM, Todd Lipcon <todd@cloudera.com> wrote:
On Fri, Mar 16, 2018 at 12:30 PM, Clifford= Resnick <cresnick@mediamath.com> wrote:
I thought I had read that the Kudu client can configure a scan for CLO= SEST_REPLICA and assumed this was a way to take advantage of data collocati= on.

Yea, when a client uses CLOSEST_REPLICA it will read a local one if av= ailable. However, that doesn't influence the higher level operation of = the Impala (or Spark) planner. The planner isn't aware of the replicati= on policy, so it will use one of the existing supported JOIN strategies. Given statistics, it will choose to broadcast t= he small table, which means that it will create a plan that looks like:


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0+-------------------------+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 +---------->build=C2= =A0 =C2=A0 =C2=A0 JOIN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0|
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 probe=C2=A0 = =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0+--------------+=C2=A0 +-----------------------= --+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0| Exchange=C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 +----+ (broadcast=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A0 +--------------+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
=C2=A0 =C2=A0 =C2=A0 +---------+= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 +-----------------------+
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 SCAN= =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 KUDU= =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0SCAN (other side)=C2=A0 =C2=A0|
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
=C2=A0 =C2=A0 =C2=A0 +---------+= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 +-----------------------+

(hopefully the ASCII art c= omes through)

In other words, the "= scan kudu" operator scans the table once, and then replicates the resu= lts of that scan into the JOIN operator. The "scan kudu" operator= of course will read its local copy, but it will still go through the exchange process.

For the use case you'r= e talking about, where the join is just looking up a single row by PK in a = dimension table, ideally we'd be using an altogether different join str= ategy such as nested-loop join, with the inner "loop" actually being a Kudu PK lookup, but that strategy isn= 9;t implemented by Impala.

-Todd

=C2=A0
=C2=A0If this exists then how far out of context is my understanding o= f it? Reading about HDFS cache replication, I=C2=A0do know that Impala will= choose a random replica there to more evenly distribute load. But especial= ly compared to Kudu upsert, managing mutable data using Parquet is painful. So, perhaps to sum thing up, if nearly 100%= of my metadata scan are single Primary Key lookups followed by a tiny broa= dcast then am I really just splitting hairs performance-wise between Kudu a= nd HDFS-cached parquet?

From:=C2=A0 Todd Lipcon <todd@clo= udera.com>
Reply-To: "user@kudu.apache.= org" <user@kudu.apache.org>
Date: Friday, March 16, 2018 at 2:5= 1 PM

To: "user@kudu.apache.org" <user@kudu.apache.org>
Subject: Re: "broadcast" = tablet replication for kudu?

It's worth noting that, even if your table is replicat= ed, Impala's planner is unaware of this fact and it will give the same = plan regardless. That is to say, rather than every node scanning its local = copy, instead a single node will perform the whole scan (assuming it's a small table) and broadcast it from there w= ithin the scope of a single query. So, I don't think you'll see any= performance improvements on Impala queries by attempting something like an= extremely high replication count.

I could see bumping the replication count to 5 for these tables since = the extra storage cost is low and it will ensure higher availability of the= important central tables, but I'd be surprised if there is any measura= ble perf impact.

-Todd

On Fri, Mar 16, 2018 at 11:35 AM, Clifford Resni= ck <cresnick@mediamath.com> wrote:
Thanks for that, glad I was wrong there! Aside from replication consid= erations, is it also recommended the number of tablet servers be odd?

I will check forums as you suggested, but from what I read after searc= hing is that Impala relies on user configured caching strategies using HDFS= cache.=C2=A0 The workload for these tables is very light write, maybe a do= zen or so records per hour across 6 or 7 tables. The size of the tables ranges from thousands to low millions of = rows so so sub-partitioning would not be required. So perhaps this is not a= typical use-case but I think it could work quite well with kudu.

From: Dan Burkert <danburkert= @apache.org>
Reply-To: "user@kudu.apache.= org" <user@kudu.apache.org>
Date: Friday, March 16, 2018 at 2:0= 9 PM
To: "user@kudu.apache.org" <user@kudu.apache.org>
Subject: Re: "broadcast" = tablet replication for kudu?

The replication count is the number of tablet servers which Kudu will = host copies on.=C2=A0 So if you set the replication level to 5, Kudu will p= ut the data on 5 separate tablet servers.=C2=A0 There's no built-in bro= adcast table feature; upping the replication factor is the closest thing.=C2=A0 A couple of things to keep in mind:

- Always use an odd replication count.=C2=A0 This is important due to how t= he Raft algorithm works.=C2=A0 Recent versions of Kudu won't even let y= ou specify an even number without flipping some flags.
- We don't test much much beyond 5 replicas.=C2=A0 It should wor= k, but you may run in to issues since it's a relatively rare configurat= ion.=C2=A0 With a heavy write workload and many replicas you are even more = likely to encounter issues.

It's also worth checking in an Impala forum whether it has feature= s that make joins against small broadcast tables better?=C2=A0 Perhaps Impa= la can cache small tables locally when doing joins.

- Dan

On Fri, Mar 16, 2018 at 10:55 AM, Clifford Resni= ck <cresnick@mediamath.com> wrote:
The problem is, AFIK, that replication count is not neces= sarily the distribution count, so you can't guarantee all tablet server= s will have a copy.

On Mar 16, 2018 1:41 PM, Boris Tyukin <bor= is@boristyukin.com> wrote:
I'm new to Kudu but we are also going to use Impala mo= stly with Kudu. We have a few tables that are small but used a lot. My plan= is replicate them more than 3 times. When you create a kudu table, you can= specify number of replicated copies (3 by default) and I guess you can put there a number, corresponding to your = node count in cluster. The downside, you cannot change that number unless y= ou recreate a table.

On Fri, Mar 16, 2018 at 10:42 AM, Cliff Resnick = <cresny@gmail.com> wrote:
We will soon be moving our analytics from AWS Redshift to = Impala/Kudu. One Redshift feature that we will miss is its ALL Distribution= , where a copy of a table is maintained on each server. We define a number = of metadata tables this way since they are used in nearly every query. We are considering using parquet in H= DFS cache for these, and Kudu would be a much better fit for the update sem= antics but we are worried about the additional contention.=C2=A0 I'm wo= ndering if having a Broadcast, or ALL, tablet replication might be an easy feature to add to Kudu?=C2=A0

-Cliff=C2=A0





--
Todd Lipcon
Software Engineer, Cloudera



--
Todd Lipcon
Software Engineer, Cloudera




--
Todd Lipcon
Software Engineer, Cloudera



--
MAURICIO ARISTIZABAL
Architect - Business Intelligence + Data Science=C2=A0
mauricio@impactradius.com(m)+1 323 309 4260=C2=A0
223 E. De La Guerra St. | Santa Barbara, CA 93101

Overview=C2=A0|=C2=A0Twitter=C2=A0|=C2=A0Faceb= ook=C2=A0|=C2=A0LinkedIn



--
Todd Lipcon
Software Engineer, Cloudera



--
Mauricio Aristizabal
Architect - Data Pipeline
M=C2=A0=C2=A0323 309 4260
E=C2=A0= =C2=A0mauricio@impact.com=C2=A0 |=C2=A0=C2=A0W =C2=A0= https://impact.com
=C2=A0=C2=A0=C2=A0=C2=A0




--
Mauricio Aristizabal
Architect - Data Pipeline
M=C2=A0=C2=A0323 309 4260
E=C2=A0= =C2=A0mauricio@impact.com=C2=A0 |=C2=A0=C2=A0W =C2=A0= https://impact.com
=C2=A0=C2=A0=C2=A0=C2=A0

--000000000000b2b7120571ab5983--