Thread: JDBC performance

JDBC performance

From
"Keith L. Musser"
Date:
Hi,

I'm new to PostgreSQL.  I'm using JDBC7.0-1.2.jar and PostgreSQL 6.5.2.

Just to understand performance, I'm running a set of repeated queries on
the same data, selecting one row by primary key.  I'm running them as
fast as the CPU can go.  I'm finding that for these simple queries on an
indexed table, my CPU spends about 60% of the time in JDBC, and about
40% of the time in the postmaster backend.

(Each query takes 2 msec on my machine, RH Linux 6.2, 733 MHz Intel, w/
lots of memory.)

I was hoping the client-side overhead would be less.

(a) Any hints on getting good performance when using JDBC?
(b) How much better is the client-side overhead if I were using C
instead of Java?
(c) Do many of you use Java to access PGSQL?

Keith L. Musser
Integrated Dynamics, Inc.
812-371-7777
email:  kmusser@idisys.com



Re: JDBC performance

From
Gunnar R|nning
Date:
"Keith L. Musser" <kmusser@idisys.com> writes:

> I was hoping the client-side overhead would be less.
>
> (a) Any hints on getting good performance when using JDBC?

Well. I'm usually caching objects on the Java side for frequent queries.

> (b) How much better is the client-side overhead if I were using C
> instead of Java?

Possibly, but I doubt it would do to much. I think the JDBC driver could be
tuned to perform better though. I noticed for instance that the conversion
step from byte to char is taking up considerable time compared to executing
and getting the raw query result. I run the JDBC driver through the
OptimizeIT profiler and found that a lot of the overhead was in the
interpretation of the returned result. ReceiveString and ReceiveTuple where
clear bottlenecks.

> (c) Do many of you use Java to access PGSQL?


Yup. We have been deploying 3 different web applications for our clients
using servlet technology and Java  to access PostgreSQL. We are however
using the 7.0.2 release of PostgreSQL.

Regards,

    Gunnar