JDBC and Postgresql 8.0 - cpu usage question - Mailing list pgsql-general

From Brent Friedman
Subject JDBC and Postgresql 8.0 - cpu usage question
Date
Msg-id 47B4B008.20808@scanonline.com
Whole thread Raw
List pgsql-general
We are running a Java app with Tomcat 5.0.x and Postgres 8.0.x on a
linux machine:  2.6.16 kernel, dual processor, 16gb ram, 2 scsi drives.
The machine runs a few other ongoing applications that handle
replication, but their impact on performance should be constant over time.

The application is using apache/jakarta (jndi) connection pooling with
Tomcat.  We are using this jdbc driver:  postgresql-8.0-315.jdbc3.jar.

Some of the queries that we are running must use serial counts, so I
know those are not as fast as in other rdbms.  With five to ten clients
of the jsp/servlet application, I am seeing very high cpu usage
associated with what are apparently idle threads.

postgres 26999  0.0  0.0 116080  9984 ?        S    14:51   0:00  \_
postgres: <user> <db> <ip>   (62233) idle
postgres  2090 20.6  0.5 114844 85876 ?        S    17:31  43:29  \_
postgres: <user> <db> <ip> (42411) idle
postgres  5968 24.1  0.5 114844 84888 ?        S    18:55  30:19  \_
postgres: <user> <db> <ip> (41929) idle
                        ^^^^

The 20.6 and 24.1 numbers represent cpu usage, as reported from ps -auxf.

Based on the time of day, these values can run from very low (2% or so)
to 30% or more.  The connection pool has a range of 5 to 25, and these
conditions reflect a very low usage level, with maybe 5-6 concurrent
connections in the pool.

We are closing all jndi connections after use, but we are not
specifically invoking garbage collection or forcing use of a destroyer
method.

Any ideas about the jdbc type 3 driver, or tomcat connection pooling
with a Sun jvm on linux?  The application itself represents a constant
load factor, with queries executing every minute on a cron - type
schedule (http://www.sauronsoftware.it/projects/cron4j/).

Thanks,

Brent Friedman


pgsql-general by date:

Previous
From: "Greg Fausak"
Date:
Subject: Re: Maximum realistic number of database user accounts?
Next
From: "Daniel Verite"
Date:
Subject: Re: How to cope with low disk space