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 854C7200CA7 for ; Wed, 31 May 2017 01:18:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 83B8D160BDC; Tue, 30 May 2017 23:18:02 +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 A58A2160BC9 for ; Wed, 31 May 2017 01:18:01 +0200 (CEST) Received: (qmail 74458 invoked by uid 500); 30 May 2017 23:18:00 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 74447 invoked by uid 99); 30 May 2017 23:18:00 -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, 30 May 2017 23:18:00 +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 3A4FA1A005F for ; Tue, 30 May 2017 23:18:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.162 X-Spam-Level: * X-Spam-Status: No, score=1.162 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] 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 4okjn7YjDtzt for ; Tue, 30 May 2017 23:17:59 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id C0EF45F36B for ; Tue, 30 May 2017 23:17:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id v4UNHw6d000950; Tue, 30 May 2017 23:17:58 GMT Message-Id: <201705302317.v4UNHw6d000950@ip-10-146-233-104.ec2.internal> Date: Tue, 30 May 2017 23:17:58 +0000 From: "Tim Armstrong (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Dan Hecht Reply-To: tarmstrong@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-5160=3A_adjust_spill_buffer_size_based_on_planner_estimates=0A?= X-Gerrit-Change-Id: I57b5b4c528325d478c8a9b834a6bc5dedab54b5b X-Gerrit-ChangeURL: X-Gerrit-Commit: 20c3ad6330da5ff0e28d20a0c429ca1bb3077d96 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.7 archived-at: Tue, 30 May 2017 23:18:02 -0000 Tim Armstrong has posted comments on this change. Change subject: IMPALA-5160: adjust spill buffer size based on planner estimates ...................................................................... Patch Set 6: The main scenario where it could lead to additional spilling (assuming mem_limit is fixed) is if the scans grabbed memory that the spillable operators would otherwise have been able to use. Otherwise it could result in different operators spilling, which could have positive or negative impacts on perf. If we get it right we'll reduce spilling because more memory can be devoted to the operators that need it. I ran a few TPC-H queries to compare estimated memory with peak memory. E.g. TPC-H Q9 is below. The estimates are off by quite a bit in some cases, but the error comes mainly from the non-linear memory consumption of the 64kb/512kb/8mb buffer size ramp-up in the old code, rather than cardinality estimation errors. Operator #Hosts Avg Time Max Time #Rows Est. #Rows Peak Mem Est. Peak Mem Detail --------------------------------------------------------------------------------------------------------------------------- 21:MERGING-EXCHANGE 1 149.369us 149.369us 175 61.70K 0 0 UNPARTITIONED 12:SORT 3 410.974us 547.810us 175 61.70K 24.02 MB 16.00 MB 20:AGGREGATE 3 1.261ms 1.306ms 175 61.70K 2.30 MB 10.00 MB FINALIZE 19:EXCHANGE 3 68.482us 81.851us 525 61.70K 0 0 HASH(nation,o_year) 11:AGGREGATE 3 201.760ms 217.919ms 525 61.70K 2.11 MB 10.00 MB STREAMING 10:HASH JOIN 3 26.906ms 37.907ms 319.40K 574.29K 1.06 MB 690.00 B INNER JOIN, BROADCAST |--18:EXCHANGE 3 17.306us 17.720us 25 25 0 0 BROADCAST | 05:SCAN HDFS 1 17.458ms 17.458ms 25 25 43.00 KB 32.00 MB tpch.nation 09:HASH JOIN 3 114.307ms 155.488ms 319.40K 574.29K 169.40 MB 20.14 MB INNER JOIN, BROADCAST |--17:EXCHANGE 3 284.583ms 296.048ms 800.00K 800.00K 0 0 BROADCAST | 03:SCAN HDFS 1 373.590ms 373.590ms 800.00K 800.00K 32.46 MB 176.00 MB tpch.partsupp 08:HASH JOIN 3 39.011ms 43.315ms 319.40K 574.29K 1.52 MB 107.42 KB INNER JOIN, BROADCAST |--16:EXCHANGE 3 2.050ms 2.485ms 10.00K 10.00K 0 0 BROADCAST | 01:SCAN HDFS 1 775.848ms 775.848ms 10.00K 10.00K 2.04 MB 32.00 MB tpch.supplier 07:HASH JOIN 3 722.690ms 736.289ms 319.40K 574.29K 153.17 MB 17.83 MB INNER JOIN, PARTITIONED |--15:EXCHANGE 3 187.995ms 194.122ms 1.50M 1.50M 0 0 HASH(o_orderkey) | 04:SCAN HDFS 2 318.553ms 512.326ms 1.50M 1.50M 42.05 MB 176.00 MB tpch.orders 14:EXCHANGE 3 41.321ms 62.755ms 319.40K 598.58K 0 0 HASH(l_orderkey) 06:HASH JOIN 3 256.056ms 273.355ms 319.40K 598.58K 1.47 MB 1.19 MB INNER JOIN, BROADCAST |--13:EXCHANGE 3 1.733ms 1.972ms 10.66K 20.00K 0 0 BROADCAST | 00:SCAN HDFS 1 821.018ms 821.018ms 10.66K 20.00K 32.04 MB 64.00 MB tpch.part 02:SCAN HDFS 3 2s611ms 2s690ms 6.00M 6.00M 64.23 MB 264.00 MB tpch.lineitem It sounds like we would need to test this with the new code - using the old code won't give any insights because it will be dominated by behaviour that doesn't carry over. Interestingly we might actually win back a fair bit of memory and therefore reduce spilling by avoiding the big jump in memory consumption of 8MB buffers. I think it might be best, if possible, to agree on the planner mechanism first and then tune the policy based on experiments with a more final version of query execution. I could do experiments with the current prototype of query execution but it feels a bit speculative until more pieces are in place. -- To view, visit http://gerrit.cloudera.org:8080/6963 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I57b5b4c528325d478c8a9b834a6bc5dedab54b5b Gerrit-PatchSet: 6 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Tim Armstrong Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Tim Armstrong Gerrit-HasComments: No