Thread: Re: Re: JDBC Performance

Re: Re: JDBC Performance

From
"Keith L. Musser"
Date:
Gunnar,
 
Sorry about getting the wrong name.  Yes, I was referring to the modifications you posted.  I ran a few more tests, which I think will clarify things:
 
                                 Test #1   Test #2   Test #2 w/ GC
                               ----------  ---------  -----------
jdbc7.0-1.2.jar                  1.89 ms    5.0 ms     3.9 ms
postgresql.jar (191450 bytes)    1.36 ms    3.1 ms     3.2 ms
postgresql.jar (204223 bytes)    1.78 ms    3.9 ms     4.1 ms
 
In Test #2 w/ GC, I purposefully ran System.gc() every 150 msec during the test.  This reduces my dependence on how often I create and free objects.  It also made the original driver faster than the new one.
 
The times depend significantly on what I do in my program -- if I cache results, I can see execution times slow down significantly (sometimes slower by a factor of 20!).  (The numbers above are with the cache turned OFF.)  That's why I'm running the GC frequently; with it, I get consistently good times.
 
The two versions of postgresql.jar are both less sensitive to memory allocation in my part of the program.  That is, the times do no grow when I use a cache with these drivers.
 
I conclude the following:
-----------------------------
(1) the older postgresql.jar is faster than the newer one (the 191450 byte version is older).  I don't know what's the difference; I didn't every realize I had two different versions until this morning.
 
(2) both are faster than jdbc7.0-1.2.jar in most circumstances
 
(3) use of System.gc() can significantly alter execution times, making benchmarking very difficult.
 
Hope this helps.  I've attached the source for "Test #1".  Test #2 is more
complicated, and probably not worth your effort -- it depends so heavily on how System.gc() is called.
 
- Keith
 
P.S.  My system is RH Linux 6.2, PostgreSQL 6.5.3 on i686-pc-linux-gnu, JVM is JDK1.2.2_006 with green threads.
 
-----Original Message-----
From: Gunnar R|nning <gunnar@candleweb.no>
To: Keith L. Musser <kmusser@idisys.com>
Cc: PGSQL-General <pgsql-general@postgresql.org>
Date: Monday, October 09, 2000 11:17 PM
Subject: Re: [GENERAL] Re: JDBC Performance

>"Keith L. Musser" <kmusser@idisys.com> writes:
>
>> I did try out Peter's new JDBC driver on two very simple query-only
>> applications.  It was about 15% slower on one of the apps and 10% faster
>> on the other, compared with jdbc7.0-1.2.jar.  It worked correctly on
>> both tests.
>>
>> Neither is particularly representative, but the fact that one's faster
>> an one's slower is surprising.  I have not had the time to dig into why
>> the discrepancy.
>>
>
>I assume you mean the driver the modifications I posted, unless Peter
>hasn't checked in anything to CVS recently that I am unaware off ? (I'm not
>online with my CVS snapshot at the moment...)
>
>I would sure like to see your applications(or the differences between
>them), so I can take a look at analyzing the discrepancies. Also platform
>information like jdk version, vendor and OS information is interesting. I
>suspect that the optimizations I did can have different effects depending
>on the cost of allocating new objects in a specific environment.
>
>Regards,
>
> Gunnar
>

Re: Re: JDBC Performance

From
Peter Mount
Date:
On Tue, 10 Oct 2000, Keith L. Musser wrote:

> jdbc7.0-1.2.jar                  1.89 ms    5.0 ms     3.9 ms
> postgresql.jar (191450 bytes)    1.36 ms    3.1 ms     3.2 ms
> postgresql.jar (204223 bytes)    1.78 ms    3.9 ms     4.1 ms
>
> In Test #2 w/ GC, I purposefully ran System.gc() every 150 msec during
> the test.  This reduces my dependence on how often I create and free
> objects.  It also made the original driver faster than the new one.
>
> The times depend significantly on what I do in my program -- if I
> cache results, I can see execution times slow down significantly
> (sometimes slower by a factor of 20!).  (The numbers above are with
> the cache turned OFF.)  That's why I'm running the GC frequently; with
> it, I get consistently good times.
>
> The two versions of postgresql.jar are both less sensitive to memory
> allocation in my part of the program.  That is, the times do no grow
> when I use a cache with these drivers.
>
> I conclude the following: -----------------------------

> (1) the older postgresql.jar is faster than the newer one (the 191450
> byte version is older).  I don't know what's the difference; I didn't
> every realize I had two different versions until this morning.

jdbc7.0-1.2.jar is the 7.0.0 driver, so has none of Gunnar's optimisations
in it, so it suffers a lot from a lot of allocations.

Peter

--
Peter T Mount peter@retep.org.uk http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/