Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4AC2A18F1B for ; Mon, 27 Jul 2015 22:45:48 +0000 (UTC) Received: (qmail 60061 invoked by uid 500); 27 Jul 2015 22:45:48 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 60007 invoked by uid 500); 27 Jul 2015 22:45:48 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 59994 invoked by uid 99); 27 Jul 2015 22:45:47 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jul 2015 22:45:47 +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 62C66C0473 for ; Mon, 27 Jul 2015 22:45:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.001 X-Spam-Level: *** X-Spam-Status: No, score=3.001 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id mJo4AGoEqRY0 for ; Mon, 27 Jul 2015 22:45:34 +0000 (UTC) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 8819F2C69A for ; Mon, 27 Jul 2015 22:45:33 +0000 (UTC) Received: by wibxm9 with SMTP id xm9so132334887wib.0 for ; Mon, 27 Jul 2015 15:45:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=w+AF4mZqGJsG3UelWgZx3+BSKIpZJfUuoD9vwEDacd8=; b=jyKTPSvUTwsLjEvcojOXZzDkm8SmQeRKjOCnzYY+R7FXRqqTm0bKBsfIIWZFMl/2Ik 8WAXrU83Gh9SeaTpMKVP1dxwkc8F2sXDZ8lgAgiCkbjtXyv/5SpUf6eUBx4WwsXFxmT9 R8ag4qvfY7h+yqbFT4UIGwW/VhGfnUumO17Y4yo4O0EeJjW1IfIKV1Q/eClc4fqUVtmJ B9uEZuu1fTuzDGrJAGwqdTvjjYjwYQhPZ9eL9EK1MJQlofftKodqYWatqmCC4UmZ4h1k fJStclUEFET9LgMkCHNKXW8mdKFDqRCbGR2WskznjbUj0dFQYvXC2d/M3UCABkhHFY0h IH1A== X-Gm-Message-State: ALoCoQkBW2Jcvp+HF2eEjaJYLH6n6zKGR2b3ohpQil3rA3KtRY9KEVK3IcLa66zt+MayCut2wUl3 MIME-Version: 1.0 X-Received: by 10.194.10.165 with SMTP id j5mr63405500wjb.147.1438037132320; Mon, 27 Jul 2015 15:45:32 -0700 (PDT) Received: by 10.27.93.193 with HTTP; Mon, 27 Jul 2015 15:45:32 -0700 (PDT) X-Originating-IP: [209.37.102.178] In-Reply-To: References: Date: Mon, 27 Jul 2015 15:45:32 -0700 Message-ID: Subject: Re: Suspicious direct memory consumption when running queries concurrently From: Jacques Nadeau To: dev@drill.apache.org Content-Type: multipart/alternative; boundary=e89a8f642b06722b20051be31c48 --e89a8f642b06722b20051be31c48 Content-Type: text/plain; charset=UTF-8 A allocate -> release cycle all on the same thread goes into a per thread cache. A bunch of Netty arena settings are configurable. The big issue I believe is that the limits are soft limits implemented by the allocation-time release mechanism. As such, if you allocate a bunch of memory, then release it all, that won't necessarily trigger any actual chunk releases. -- Jacques Nadeau CTO and Co-Founder, Dremio On Mon, Jul 27, 2015 at 12:47 PM, Abdel Hakim Deneche wrote: > @Jacques, my understanding is that chunks are not owned by specific a > thread but they are part of a specific memory arena which is in turn only > accessed by specific threads. Do you want me to find which threads are > associated with the same arena where we have hanging chunks ? > > > On Mon, Jul 27, 2015 at 11:04 AM, Jacques Nadeau > wrote: > > > It sounds like your statement is that we're cacheing too many unused > > chunks. Hanifi and I previously discussed implementing a separate > flushing > > mechanism to release unallocated chunks that are hanging around. The > main > > question is, why are so many chunks hanging around and what threads are > > they associated with. A Jmap dump and analysis should allow you to do > > determine which thread owns the excess chunks. My guess would be the RPC > > pool since those are long lasting (as opposed to the WorkManager pool, > > which is contracting). > > > > -- > > Jacques Nadeau > > CTO and Co-Founder, Dremio > > > > On Mon, Jul 27, 2015 at 9:53 AM, Abdel Hakim Deneche < > > adeneche@maprtech.com> > > wrote: > > > > > When running a set of, mostly window function, queries concurrently on > a > > > single drillbit with a 8GB max direct memory. We are seeing a > continuous > > > increase of direct memory allocation. > > > > > > We repeat the following steps multiple times: > > > - we launch in "iteration" of tests that will run all queries in a > random > > > order, 10 queries at a time > > > - after the iteration finishes, we wait for a couple of minute to give > > > Drill time to release the memory being held by the finishing fragments > > > > > > Using Drill's memory logger ("drill.allocator") we were able to get > > > snapshots of how memory was internally used by Netty, we only focused > on > > > the number of allocated chunks, if we take this number and multiply it > by > > > 16MB (netty's chunk size) we get approximately the same value reported > by > > > Drill's direct memory allocation. > > > Here is a graph that shows the evolution of the number of allocated > > chunks > > > on a 500 iterations run (I'm working on improving the plots) : > > > > > > http://bit.ly/1JL6Kp3 > > > > > > In this specific case, after the first iteration Drill was allocating > > ~2GB > > > of direct memory, this number kept rising after each iteration to ~6GB. > > We > > > suspect this caused one of our previous runs to crash the JVM. > > > > > > If we only focus on the log lines between iterations (when Drill's > memory > > > usage is below 10MB) then all allocated chunks are at most 2% usage. At > > > some point we end up with 288 nearly empty chunks, yet the next > iteration > > > will cause more chunks to be allocated!!! > > > > > > is this expected ? > > > > > > PS: I am running more tests and will update this thread with more > > > informations. > > > > > > -- > > > > > > Abdelhakim Deneche > > > > > > Software Engineer > > > > > > > > > > > > > > > Now Available - Free Hadoop On-Demand Training > > > < > > > > > > http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available > > > > > > > > > > > > > -- > > Abdelhakim Deneche > > Software Engineer > > > > > Now Available - Free Hadoop On-Demand Training > < > http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available > > > --e89a8f642b06722b20051be31c48--