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 A2361200C48 for ; Thu, 6 Apr 2017 23:35:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A0BF7160B91; Thu, 6 Apr 2017 21:35:03 +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 E82D8160B81 for ; Thu, 6 Apr 2017 23:35:02 +0200 (CEST) Received: (qmail 5007 invoked by uid 500); 6 Apr 2017 21:35:02 -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 4991 invoked by uid 99); 6 Apr 2017 21:35:00 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Apr 2017 21:35:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 476FD188897 for ; Thu, 6 Apr 2017 21:35:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id vuYSw3Y7qn7U for ; Thu, 6 Apr 2017 21:34:57 +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-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 437595F1E9 for ; Thu, 6 Apr 2017 21:34:57 +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 v36LYtiP008379; Thu, 6 Apr 2017 21:34:55 GMT Message-Id: <201704062134.v36LYtiP008379@ip-10-146-233-104.ec2.internal> Date: Thu, 6 Apr 2017 21:34:53 +0000 From: "Tim Armstrong (Code Review)" To: Dan Hecht , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Taras Bobrovytsky Reply-To: tarmstrong@cloudera.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-3203=3A_Part_2=3A_per-core_free_lists_in_buffer_pool=0A?= X-Gerrit-Change-Id: I612bd1cd0f0e87f7d8186e5bedd53a22f2d80832 X-Gerrit-ChangeURL: X-Gerrit-Commit: 22d3aebde2b646dde49dd9132f37e69ac42b9415 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: Thu, 06 Apr 2017 21:35:03 -0000 Hello Dan Hecht, I'd like you to reexamine a change. Please visit http://gerrit.cloudera.org:8080/6414 to look at the new patch set (#21). Change subject: IMPALA-3203: Part 2: per-core free lists in buffer pool ...................................................................... IMPALA-3203: Part 2: per-core free lists in buffer pool Add per-core lists of clean pages and free pages to enable allocation of buffers without contention on shared locks in the common case. This is implemented with an additional layer of abstraction in "BufferAllocator", which tracks all memory (free buffers and clean pages) that is not in use but has not been released to the OS. The old BufferAllocator is renamed to SystemAllocator. See "Spilled Page Mgmt" and "MMap Allocator & Scalable Free Lists" in https://goo.gl/0zuy97 for a high-level summary of how this fits into the buffer pool design. The guts of the new code is BufferAllocator::AllocateInternal(), which progresses through several strategies for allocating memory. Misc changes: * Enforce upper limit on buffer size to reduce the number of free lists required. * Add additional allocation counters. * Slightly reorganise the MemTracker GC functions to use lambdas and clarify the order in which they should be called. Also adds a target memory value so that they don't need to free *all* of the memory in the system. * Fix an accounting bug in the buffer pool where it didn't evict dirty pages before reclaiming a clean page. Performance: We will need to validate the performance of the system under high query concurrency before this is used as part of query execution. The benchmark in Part 1 provided some evidence that this approach of a list per core should scale well to many cores. Testing: Added buffer-allocator-test to test the free list resizing algorithm directly. Added a test to buffer-pool-test to exercise the various new memory reclamation code paths that are now possible. Also run buffer-pool-test under two different faked-out NUMA setups - one with no NUMA and another with three NUMA nodes. buffer-pool-test, suballocator-test, and buffered-tuple-stream-v2-test provide some further basic coverage. Future system and unit tests will validate this further before it is used for query execution (see IMPALA-3200). Ran an initial version of IMPALA-4114, the ported BufferedBlockMgr tests, against this. The randomised stress test revealed some accounting bugs which are fixed. I'll post those tests as a follow-on patch. Change-Id: I612bd1cd0f0e87f7d8186e5bedd53a22f2d80832 --- M be/src/benchmarks/free-lists-benchmark.cc M be/src/common/init.cc M be/src/runtime/buffered-block-mgr.cc M be/src/runtime/bufferpool/CMakeLists.txt A be/src/runtime/bufferpool/buffer-allocator-test.cc M be/src/runtime/bufferpool/buffer-allocator.cc M be/src/runtime/bufferpool/buffer-allocator.h M be/src/runtime/bufferpool/buffer-pool-counters.h M be/src/runtime/bufferpool/buffer-pool-internal.h M be/src/runtime/bufferpool/buffer-pool-test.cc M be/src/runtime/bufferpool/buffer-pool.cc M be/src/runtime/bufferpool/buffer-pool.h M be/src/runtime/bufferpool/free-list-test.cc M be/src/runtime/bufferpool/free-list.h M be/src/runtime/bufferpool/suballocator-test.cc M be/src/runtime/bufferpool/suballocator.h A be/src/runtime/bufferpool/system-allocator.cc A be/src/runtime/bufferpool/system-allocator.h M be/src/runtime/disk-io-mgr.cc M be/src/runtime/disk-io-mgr.h M be/src/runtime/exec-env.cc M be/src/runtime/mem-tracker.cc M be/src/runtime/mem-tracker.h M be/src/runtime/tmp-file-mgr-test.cc M be/src/runtime/tmp-file-mgr.cc M be/src/runtime/tmp-file-mgr.h A be/src/testutil/cpu-util.h A be/src/testutil/rand-util.h M be/src/util/cpu-info.cc M be/src/util/cpu-info.h 30 files changed, 1,569 insertions(+), 367 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/14/6414/21 -- To view, visit http://gerrit.cloudera.org:8080/6414 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I612bd1cd0f0e87f7d8186e5bedd53a22f2d80832 Gerrit-PatchSet: 21 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Tim Armstrong Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Taras Bobrovytsky Gerrit-Reviewer: Tim Armstrong