Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-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 ADD3A18697 for ; Fri, 5 Jun 2015 16:15:14 +0000 (UTC) Received: (qmail 41534 invoked by uid 500); 5 Jun 2015 16:15:13 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 41454 invoked by uid 500); 5 Jun 2015 16:15:13 -0000 Mailing-List: contact dev-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 dev@hive.apache.org Received: (qmail 41442 invoked by uid 99); 5 Jun 2015 16:15:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2015 16:15:13 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of thejas.nair@gmail.com designates 209.85.220.173 as permitted sender) Received: from [209.85.220.173] (HELO mail-qk0-f173.google.com) (209.85.220.173) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2015 16:12:59 +0000 Received: by qkhq76 with SMTP id q76so42910275qkh.2 for ; Fri, 05 Jun 2015 09:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=kZqSmMjVee1QgfI4IAXgNOqgl4sCV+pqNfaoCnsPO5w=; b=gdGJkTsd9+ILegVA34PI2DSzRZ876wNrYQmZmUBZZNfi//KONOGS2PYd899D4/F8WU NEfApKtbzRTKFEPu68+8eJTsOrJjez6a5O80UqerQNlssPgtU0jKTy2vq97eYjOTWhIG 1JJEUVWiCCAuavZc4E+eAIQa1+74W3Ltb6Q1cAv91VUXhe77yryXa949VhMslmX5NY+c s3eu7ETJz1I//03vmrGFe1B/ffgQdN2TcGJwHTIDcgWLFBd/Jf1Jf6X5WBoFV9TblE6j pnux/JUmFKM4qU8De4g247bQ0hkKkSwiwGTL05YQjtE/JlEsAFYznTUoCVBPnFIzQy+2 L5vw== MIME-Version: 1.0 X-Received: by 10.140.39.209 with SMTP id v75mr4938079qgv.34.1433520886689; Fri, 05 Jun 2015 09:14:46 -0700 (PDT) Received: by 10.140.93.45 with HTTP; Fri, 5 Jun 2015 09:14:46 -0700 (PDT) In-Reply-To: <8B5F7C57-D42D-4A20-BF4E-0B8A5A838D9D@premierinc.com> References: <8B5F7C57-D42D-4A20-BF4E-0B8A5A838D9D@premierinc.com> Date: Fri, 5 Jun 2015 09:14:46 -0700 Message-ID: Subject: Re: connection pooling for hive JDBC client From: Thejas Nair To: dev Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org It is better to use re-use the hive jdbc connection if possible, as there are costs associated with creating new connection. However, there are known issues in running multiple queries simultaneously using a single connection. For now, it woudl be safer to run queries sequentially within a connection (ie, don't share it across threads and run concurrent queries). (You can ofcourse run queries in parallel using different connections). Regarding connection pooling libraries, I am not sure if that has been tested. There might be issues like that unsupported api call you mentioned, that need to be fixed. On Fri, Jun 5, 2015 at 6:50 AM, McWhorter, David wrote: > Hello, I sent this email to the users list a few days ago but no one ther= e seems to be able to help, so I am trying the dev list. I am working on a= n application that queries and interacts with hive using the JDBC API. In = many other cases, using a JDBC connection pool such as commons-dbcp or Bone= CP or HikariCP is a recommended practice and results in much better perform= ance. All of the examples I=E2=80=99ve found of using accessing Hive throu= gh the JDBC API (such as https://cwiki.apache.org/confluence/display/Hive/H= iveServer2+Clients#HiveServer2Clients-JDBCClientSampleCode) use a raw JDBC = connection to Hive directly. A few questions: > > 1. Should hive work with connection pools such as commons-dbcp, BoneCP= , or HikariCP? > * Note: I have tried all BoneCP and HikariCP, and cannot seem to g= et either to work because HiveConnection.setReadOnly throws a java.sql.SQLE= xception saying =E2=80=9CMethod not supported=E2=80=9D. I am using hive 0.= 14.0. > 2. Do you recommended using a JDBC connection pool for interacting wit= h hive from an application that will execute many repeated and concurrent q= ueries/statements? > > Also, just to be clear, I am not asking about configuring the Hive metast= ore to use a connection pool to connect to its underlying database (MySQL, = PostgreSQL, etc), but about using a connection pool to interact with and qu= ery Hive through the JDBC api from an application. > > Thank you, > David McWhorter > > =E2=80=94 > > David McWhorter > Senior Developer, Foundations > Informatics and Technology Services > Office: 434.260.5232 | Mobile: 434.227.2551 > david_mcwhorter@premierinc.com | = Premier, Inc. (NASDAQ: PINC)