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 D5168200BCB for ; Thu, 24 Nov 2016 09:05:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D321F160B1E; Thu, 24 Nov 2016 08:05:21 +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 01CCA160B11 for ; Thu, 24 Nov 2016 09:05:20 +0100 (CET) Received: (qmail 43696 invoked by uid 500); 24 Nov 2016 08:05:20 -0000 Mailing-List: contact commits-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@impala.incubator.apache.org Delivered-To: mailing list commits@impala.incubator.apache.org Received: (qmail 43687 invoked by uid 99); 24 Nov 2016 08:05:20 -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, 24 Nov 2016 08:05:20 +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 C84B1180334 for ; Thu, 24 Nov 2016 08:05:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] 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 I8YnX3Y-kJar for ; Thu, 24 Nov 2016 08:05:18 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 5FC8E5F307 for ; Thu, 24 Nov 2016 08:05:17 +0000 (UTC) Received: (qmail 42179 invoked by uid 99); 24 Nov 2016 08:04:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2016 08:04:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0256CEEE34; Thu, 24 Nov 2016 08:04:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tarmstrong@apache.org To: commits@impala.incubator.apache.org Date: Thu, 24 Nov 2016 08:04:42 -0000 Message-Id: In-Reply-To: <6165e5d1c843477abaf1925a13471c27@git.apache.org> References: <6165e5d1c843477abaf1925a13471c27@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/7] incubator-impala git commit: IMPALA-4522: Bound Kudu client threads to avoid stress crash archived-at: Thu, 24 Nov 2016 08:05:22 -0000 IMPALA-4522: Bound Kudu client threads to avoid stress crash In stress testing on physical boxes (80 cores, 200gb ram) we discovered that the Kudu Java client creates a huge number of threads (2x the #cores) per Kudu client, and this was causing the impalad to crash when the JVM couldn't create more threads. This addresses the issue by setting the number of Kudu client worker threads rather than letting the Kudu client pick the default (2 * #cores). The number set here was suggested by the Kudu team as being sufficient for Impala's FE usage and this has been tested for 8+ hours on the stress cluster where the crash was previously observed quickly. In the future, Impala should probably be sharing a single Kudu client (it is multithreaded), but additional support from Kudu may be needed to ensure this usage is correct (e.g. client metadata may need invalidation after some operations). Change-Id: I3940df776eaa5ad22e1bbb572559afcc8990bf1d Reviewed-on: http://gerrit.cloudera.org:8080/5205 Reviewed-by: Alex Behm Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/1fea9973 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/1fea9973 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/1fea9973 Branch: refs/heads/master Commit: 1fea9973d2cd4fd61d9377ef9ce4f5accafb41b0 Parents: 3934e13 Author: Matthew Jacobs Authored: Wed Nov 23 11:39:25 2016 -0800 Committer: Internal Jenkins Committed: Thu Nov 24 02:39:30 2016 +0000 ---------------------------------------------------------------------- .../java/org/apache/impala/util/KuduUtil.java | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/1fea9973/fe/src/main/java/org/apache/impala/util/KuduUtil.java ---------------------------------------------------------------------- diff --git a/fe/src/main/java/org/apache/impala/util/KuduUtil.java b/fe/src/main/java/org/apache/impala/util/KuduUtil.java index dd09a28..559c4a5 100644 --- a/fe/src/main/java/org/apache/impala/util/KuduUtil.java +++ b/fe/src/main/java/org/apache/impala/util/KuduUtil.java @@ -22,37 +22,42 @@ import static java.lang.String.format; import java.util.HashSet; import java.util.List; +import org.apache.impala.analysis.Expr; +import org.apache.impala.analysis.LiteralExpr; import org.apache.impala.catalog.ScalarType; import org.apache.impala.catalog.Type; import org.apache.impala.common.ImpalaRuntimeException; import org.apache.impala.common.Pair; import org.apache.impala.service.BackendConfig; -import org.apache.impala.thrift.TExpr; -import org.apache.impala.thrift.TExprNode; -import org.apache.impala.analysis.LiteralExpr; -import org.apache.impala.analysis.Expr; import org.apache.impala.thrift.TColumn; import org.apache.impala.thrift.TColumnEncoding; +import org.apache.impala.thrift.TExpr; +import org.apache.impala.thrift.TExprNode; import org.apache.impala.thrift.THdfsCompression; - -import com.google.common.base.Splitter; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - import org.apache.kudu.ColumnSchema; -import org.apache.kudu.ColumnSchema.Encoding; import org.apache.kudu.ColumnSchema.CompressionAlgorithm; +import org.apache.kudu.ColumnSchema.Encoding; import org.apache.kudu.Schema; import org.apache.kudu.client.KuduClient; import org.apache.kudu.client.KuduClient.KuduClientBuilder; import org.apache.kudu.client.PartialRow; import org.apache.kudu.client.RangePartitionBound; +import com.google.common.base.Preconditions; +import com.google.common.base.Splitter; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + public class KuduUtil { private static final String KUDU_TABLE_NAME_PREFIX = "impala::"; + // Number of worker threads created by each KuduClient, regardless of whether or not + // they're needed. Impala does not share KuduClients between operations, so the number + // of threads created can get very large under concurrent workloads. This number should + // be sufficient for the Frontend/Catalog use, and has been tested in stress tests. + private static int KUDU_CLIENT_WORKER_THREAD_COUNT = 5; + /** * Creates a KuduClient with the specified Kudu master addresses (as a comma-separated * list of host:port pairs). The 'admin operation timeout' and the 'operation timeout' @@ -64,6 +69,7 @@ public class KuduUtil { KuduClientBuilder b = new KuduClient.KuduClientBuilder(kuduMasters); b.defaultAdminOperationTimeoutMs(BackendConfig.INSTANCE.getKuduClientTimeoutMs()); b.defaultOperationTimeoutMs(BackendConfig.INSTANCE.getKuduClientTimeoutMs()); + b.workerCount(KUDU_CLIENT_WORKER_THREAD_COUNT); return b.build(); }