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 46499200B70 for ; Sat, 27 Aug 2016 10:39:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 44C51160AB2; Sat, 27 Aug 2016 08:39:33 +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 8C788160AA6 for ; Sat, 27 Aug 2016 10:39:32 +0200 (CEST) Received: (qmail 15254 invoked by uid 500); 27 Aug 2016 08:39:31 -0000 Mailing-List: contact dev-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list dev@hawq.incubator.apache.org Received: (qmail 15242 invoked by uid 99); 27 Aug 2016 08:39:31 -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; Sat, 27 Aug 2016 08:39:31 +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 EF24A180457 for ; Sat, 27 Aug 2016 08:39:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 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, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id aMIb8Pk5KULc for ; Sat, 27 Aug 2016 08:39:29 +0000 (UTC) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 8D2385F1F0 for ; Sat, 27 Aug 2016 08:39:28 +0000 (UTC) Received: by mail-wm0-f44.google.com with SMTP id f65so19067890wmi.0 for ; Sat, 27 Aug 2016 01:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=KFlkiHn1cCxwC/IjmhARVW9NEox3nS5RWRMPjv9F+aw=; b=XBxfpQEIiPYtMzV0fEEog76SyhzcePW8FH72mXlYZ0uqCcKe2T7bbcfjiwhd0KyW0v X/XRMDx1OZbUNQrtzy3GITpvxLd/AmsWkYWUhI6WZc3kPibA8QzXnlVC/DWzHYL3T0BJ 2a4nBwpeT5RSrfm08Zri0EY1f9ewMxo8UiknszwfdaVQ0Y+DXWt1T7TZ29PxERgAsMY0 BKF8ZfmQB7yzfUyv90b+On9gXeYy6pvG8S+ip5X1XNSD+FsbMNha7Ry/q52wWj8Rmsyw S/PZo9w6RAZ+wULWMXYCUDnw+i/LEXP59QkvgKymZ/O2WYmpvt0NXq8QW9PwoYPvLbvp DCJw== 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:from:date :message-id:subject:to; bh=KFlkiHn1cCxwC/IjmhARVW9NEox3nS5RWRMPjv9F+aw=; b=T0co+7BcH7ztqybQXkaCjCQsBNYiq1tnR/qudQfpUVEubnYsdnn+RFS0WT28R8YaWC xzzhv4g7SKn848nkDxi5QIR+i3F2Xvs95KjYBxq8cWeZGsbWkMY9JPtMp4St9vam2JRs W8uq2yCjWOwIhVfStZhoCAzML+RCXqv5DJp3YFC0cYCz8S4PsVyLRDo5unRKj6BGFY9J BDg3VK4HQJYVegQXJ8fcuv1KzgSyz67UZ772o3nohuLOXUKPo3Q36AWU8mgseMQgD8W3 hpdKd6uyvIp6qB2YJrsP+8Qd4K7x6p1qOAzRzPy0p3FWT6Iz9fyP77hBr/3kr4z8e7QF n5HQ== X-Gm-Message-State: AE9vXwP5CFcfE8IwIMDZsXHWa5I/uM4gnZ9JD+2GLZaa0nfkESYN3gT1133BHSq7KfLexNCXaZXgd1zkRNQnjA== X-Received: by 10.28.207.197 with SMTP id f188mr2447706wmg.69.1472287167435; Sat, 27 Aug 2016 01:39:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.216.20 with HTTP; Sat, 27 Aug 2016 01:39:26 -0700 (PDT) In-Reply-To: References: From: Paul Guo Date: Sat, 27 Aug 2016 16:39:26 +0800 Message-ID: Subject: Re: About hawq-config slowness To: dev@hawq.incubator.apache.org Content-Type: multipart/alternative; boundary=94eb2c0d42fe9f58e9053b099176 archived-at: Sat, 27 Aug 2016 08:39:33 -0000 --94eb2c0d42fe9f58e9053b099176 Content-Type: text/plain; charset=UTF-8 Looked into python GIL documents. It looks that even being with GIL, python multiple threads could possibly help some IO-bound (at least non-cpu-bound) tasks. We could limit the worker number be equal to min(16, queue entry number). Thanks. 2016-08-23 23:06 GMT+08:00 Kyle Dunn : > Paul, > > This is a great finding! I think additional worker threads might make sense > when clusters are larger but otherwise a number like 8 is a safe bet, > especially given its positive impact on the user experience in the majority > of cases. > > +1 for tuning these down to improve latency. > > -Kyle > > On Tue, Aug 23, 2016, 08:31 Paul Guo wrote: > > > Recently I noticed hawq-config seems to be slow, e.g. A simple guc > setting > > command line "hawq config -c lc_messages -v en_US.UTF-8" roughly costs 6+ > > seconds on my centos vm, but looking into the details of the command > line, > > I found this is really not expected. > > > > Quickly looked into the haws-config and python lib code, I found it looks > > like that several issues below affects the speed. > > > > 1) gpscp > > It still uses popen2.Popen4(). This function introduces millions of > useless > > close() sys call finally in above test command. Using > > subprocess.Popen() without close_fds as an alternative easily resolve > > this. > > > > 2) gppylib/commands/base.py > > > > def __init__(self,name,pool,timeout=5): > > > > The worker thread will block at most 5 seconds in each loop (Queue.get()) > > to fetch potential commands even we have known that there will be no more > > commands to run for some threads. This really does not make sense since > > some idle threads will block for 5 seconds also before exiting. > > > > Setting timeout to zero will make python code spin. I tested a small > > timeout value e.g. 0.1s and it works fine. It seems that 0.1 is a good > > timeout candidate. > > > > 3) gppylib/commands/base.py > > > > def __init__(self,numWorkers=16,items=None): > > > > WorkerPool by default creates 16 threads but to my knowledge, cpython's > > Thread does not work fine due to the global GIL lock. I'm not an python > > expert so I'm wondering whether less thread number (e.g. 8) is really > > enough? Either from theory or from practice (e.g.previous test results). > > > -- > *Kyle Dunn | Data Engineering | Pivotal* > Direct: 303.905.3171 <3039053171> | Email: kdunn@pivotal.io > --94eb2c0d42fe9f58e9053b099176--