From issues-return-148526-archive-asf-public=cust-asf.ponee.io@hive.apache.org Mon Feb 4 16:33:47 2019 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 0C72C180679 for ; Mon, 4 Feb 2019 17:33:46 +0100 (CET) Received: (qmail 29603 invoked by uid 500); 4 Feb 2019 16:33:46 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 29594 invoked by uid 99); 4 Feb 2019 16:33:46 -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; Mon, 04 Feb 2019 16:33:46 +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 B6B35180AD4 for ; Mon, 4 Feb 2019 16:33:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled 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 5_uickM26_Un for ; Mon, 4 Feb 2019 16:33:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id A3D225FC16 for ; Mon, 4 Feb 2019 16:25:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id DC628E26E8 for ; Mon, 4 Feb 2019 16:25:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 26275243FB for ; Mon, 4 Feb 2019 16:25:01 +0000 (UTC) Date: Mon, 4 Feb 2019 16:25:01 +0000 (UTC) From: "BELUGA BEHR (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-21210) CombineHiveInputFormat Thread Pool Sizing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-21210?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] BELUGA BEHR updated HIVE-21210: ------------------------------- Status: Patch Available (was: Open) > CombineHiveInputFormat Thread Pool Sizing > ----------------------------------------- > > Key: HIVE-21210 > URL: https://issues.apache.org/jira/browse/HIVE-21210 > Project: Hive > Issue Type: Improvement > Affects Versions: 4.0.0, 3.2.0 > Reporter: BELUGA BEHR > Assignee: BELUGA BEHR > Priority: Major > Attachments: HIVE-21210.1.patch > > > Threadpools. > Hive uses threadpools in several different places and each implementation= is a little different and requires different configurations. I think that = Hive needs to reign in and standardize the way that threadpools are used an= d threadpools should scale automatically without manual configuration. At a= ny given time, there are many hundreds of threads running in the HS2 as the= number of simultaneous connections increases and they surely cause content= ion with one-another. > Here is an example: > {code:java|title=3DCombineHiveInputFormat.java} > // max number of threads we can use to check non-combinable paths > private static final int MAX_CHECK_NONCOMBINABLE_THREAD_NUM =3D 50; > private static final int DEFAULT_NUM_PATH_PER_THREAD =3D 100; > {code} > When building the splits for a MR job, there are up to 50 threads running= per query and there is not much scaling here, it's simply 1 thread : 100 f= iles ratio.=C2=A0 This implies that to process 5000 files, there are 50 thr= eads, after that, 50 threads are still used. Many Hive jobs these days invo= lve more than 5000 files so it's not scaling well on bigger sizes. > This is not configurable (even manually), it doesn't change when the hard= ware specs increase, and 50 threads seems like a lot when a service must su= pport up to 80 connections: > [https://www.cloudera.com/documentation/enterprise/5/latest/topics/admin_= hive_tuning.html] > Not to mention, I have never seen a scenario where HS2 is running on a ho= st all by itself and has the entire system dedicated to it. Therefore it sh= ould be more friendly and spin up fewer threads. > I am attaching a patch here that provides a few features: > * Common module that produces {{ExecutorService}} which caps the number = of threads it spins up at the number of processors a host has. Keep in mind= that a class may submit as much work units ({{Callables}} as they would li= ke, but the number of threads in the pool is capped. > * Common module for partitioning work. That is, allow for a generic fram= ework for dividing work into partitions (i.e. batches) > * Modify {{CombineHiveInputFormat}} to take advantage of both modules, p= erforming its same duties in a more Java OO way that is currently implement= ed > * Add a partitioning (batching) implementation that enforces partitionin= g of a {{Collection}} based on the natural log of the {{Collection}} size s= o that it scales more slowly than a simple 1:100 ratio. > * Simplify unit test code for {{CombineHiveInputFormat}} > My hope is to introduce these tools to {{CombineHiveInputFormat}} and the= n to drop it into other places. One of the things I will introduce here is= a "direct thread" {{ExecutorService}} so that even if there is a configura= tion for a thread pool to be disabled, it will still use an {{ExecutorServi= ce}} so that the project can avoid logic like "if this function is services= by a thread pool, use a {{ExecutorService}} (and remember to close it late= r!) otherwise, create a single thread" so that things like [HIVE-16949] can= be avoided in the future. Everything will just use an {{ExecutorService}}= . -- This message was sent by Atlassian JIRA (v7.6.3#76005)