Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6BvR-000467-F2 for pgsql-odbc@arkaria.postgresql.org; Thu, 04 May 2017 08:15:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d6BvQ-0007fl-RB for pgsql-odbc@arkaria.postgresql.org; Thu, 04 May 2017 08:15:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d6BvQ-0007fH-B6 for pgsql-odbc@postgresql.org; Thu, 04 May 2017 08:15:48 +0000 Received: from mail5.asahi-net.or.jp ([202.224.39.201]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6BvL-0004ur-Mr for pgsql-odbc@postgresql.org; Thu, 04 May 2017 08:15:47 +0000 Received: from [192.168.1.5] (aa029213.dynamic.ppp.asahi-net.or.jp [110.5.29.213]) (Authenticated sender: GQ9H-INUE) by mail5.asahi-net.or.jp (Postfix) with ESMTPA id 591F0117151; Thu, 4 May 2017 17:15:41 +0900 (JST) Subject: Re: PostgreSQL, and ODBC statement handles To: Reza Taheri References: <7EF51648-F53F-4C9D-BEAD-80D4CC900FA8@vmware.com> <33cdd367-6e70-aab2-fdb1-8637d13d23ff@dream.email.ne.jp> <9A7D1174-B33A-43B1-813F-65F8BF42E487@vmware.com> Cc: "pgsql-odbc@postgresql.org" From: "Inoue, Hiroshi" Message-ID: Date: Thu, 4 May 2017 17:15:40 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <9A7D1174-B33A-43B1-813F-65F8BF42E487@vmware.com> Content-Type: multipart/alternative; boundary="------------C174E3DF16FFBA579E77C6DD" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------C174E3DF16FFBA579E77C6DD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Reza, On 2017/05/04 16:57, Reza Taheri wrote: > > On 5/4/17, 12:11 AM, "Inoue, Hiroshi" > wrote: > > On 2017/05/04 15:17, Reza Taheri wrote: > > Hi Hiroshi, > > In /etc/odbcinst.ini, I set “Threading = 0”. I can > see multiple server processes in transaction in the backend > server. The contention appears to be only for access to the > statement handle, not actual database access. For example, when I > replaced looping over SQLFetch(stmt) with a single > SQLFetchScroll(stmt, SQL_FETCH_NEXT, 0), I got better results. > Same with reducing the frequency of calls to SQLBindCol() > > Thanks, > Reza > > On 5/3/17, 10:38 PM, "Inoue, Hiroshi" > wrote: > > Hi Reza, > > How are you setting 'Threading' in odbcinst.ini? > > regards, > Hiroshi > > On 2017/05/04 14:08, Reza Taheri wrote: > > I am running a benchmark (TPCx-V) with a single process on the > client system handing all the load. Each connection to the > server is in a separate thread with its own connection to > PGSQL, and its own connection handle and statement handle. I > am facing a contention problem with ODBC on the client side. > strace and perf top show we are serializing over what appears > to be accesses to the ODBC statement handlepgsq. Contention > goes away if I use multiple processes instead of multiple > threads within a process. > > I suppose I don’t understand the concept of “handles” well, > but I am surprised that > > > > all the threads get the same connection handle number and the > same statement handle number. > > > Hmm, strange. Can I confirm the situation? > > regards, > Hiroshi Inoue > > > Does that mean some data structure is shared between the > different threads? Is there a way to force different statement > handles (or handle numbers???) for different threads within > one process? I have asked this question on the ODBC mailing > list, and they suggested it could be something in the > postgresql driver. I can provide detailed performance data, > but maybe someone can help me figure out what might be a very > basic configuration or parameter setting problem. I am running > the following RPMs on RHEL 7.1: > > postgresql93-9.3.5-2PGDG.rhel7.x86_64 > > postgresql93-odbc-09.03.0300-1PGDG.rhel7.x86_64 > > unixODBC-2.3.1-10.el7.x86_64 > > Thanks, > Reza > > Hi Hiroshi, > > I am not sure what you mean by “Can I confirm the situation”. Is > there some data you would like me to collect and share? > I'd like to see the record of each thread what connection handle was allocated and where it was connected to. regards, Hiroshi Inoue --------------C174E3DF16FFBA579E77C6DD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Reza,

On 2017/05/04 16:57, Reza Taheri wrote:

 

 

On 5/4/17, 12:11 AM, "Inoue, Hiroshi" <h-inoue@dream.email.ne.jp> wrote:

 

 

 

On 2017/05/04 15:17, Reza Taheri wrote:

Hi Hiroshi,

In /etc/odbcinst.ini, I set “Threading             = 0”.  I can see multiple server processes in transaction in the backend server. The contention appears to be only for access to the statement handle, not actual database access.  For example, when I replaced looping over SQLFetch(stmt) with a single SQLFetchScroll(stmt, SQL_FETCH_NEXT, 0), I got better results. Same with reducing the frequency of calls to SQLBindCol() 

Thanks,
Reza

 

On 5/3/17, 10:38 PM, "Inoue, Hiroshi" <h-inoue@dream.email.ne.jp> wrote:

 

Hi Reza,

How are you setting 'Threading' in odbcinst.ini?

regards,
Hiroshi

On 2017/05/04 14:08, Reza Taheri wrote:

I am running a benchmark (TPCx-V) with a single process on the client system handing all the load. Each connection to the server is in a separate thread with its own connection to PGSQL, and its own connection handle and statement handle.  I am facing a contention problem with ODBC on the client side. strace and perf top show we are serializing over what appears to be accesses to the ODBC statement handlepgsq. Contention goes away if I use multiple processes instead of multiple threads within a process.

 

I suppose I don’t understand the concept of “handles” well, but I am surprised that



all the threads get the same connection handle number and the same statement handle number.


Hmm, strange. Can I confirm the situation?

regards,
Hiroshi Inoue


Does that mean some data structure is shared between the different threads? Is there a way to force different statement handles (or handle numbers???) for different threads within one process? I have asked this question on the ODBC mailing list, and they suggested it could be something in the postgresql driver. I can provide detailed performance data, but maybe someone can help me figure out what might be a very basic configuration or parameter setting problem. I am running the following RPMs on RHEL 7.1:

postgresql93-9.3.5-2PGDG.rhel7.x86_64

postgresql93-odbc-09.03.0300-1PGDG.rhel7.x86_64

unixODBC-2.3.1-10.el7.x86_64

 

Thanks,
Reza

Hi Hiroshi,

I am not sure what you mean by “Can I confirm the situation”.  Is there some data you would like me to collect and share?


I'd like to see the record of each thread what connection handle was allocated and where it was connected to.

regards,
Hiroshi Inoue --------------C174E3DF16FFBA579E77C6DD--