This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Need help compiling libgcj on Solaris for benchmark


Hi Tim,

What type of benchmark are you running?  What JDBC driver?

I've done quite a bit of JDBC benchmarking, and found it to perform
horribly slow in many environments compared to native/embedded drivers. 
One reason is that Java must rely on TCP sockets, whereas native drivers
can use faster protocols (Unix-domain sockets, named pipes, etc.). 
Another reason is that JDBC is entirely dynamic, and has no facility for
precompiling SQL.

In one particularly bad case, an INSERT statement was executing just 4
rows/sec.  I had been using a PreparedStatement, and calling setXXX()
for each parameter... it turns out that JDBC driver was invoking the DB
engine on each call, so roughly 20 network round-trips were required for
each INSERT!  After some optimizations I got the performance up to 200
rows/sec, at which point the network interface became the bottleneck.

Unfortunately SQL has no standard batch insert/update utilties. 
Although most SQL DBMS products implement some sort of batch insert,
they aren't available in JDBC.

I don't know how much gcj will help.  Native code (type 2) drivers can
help, but they aren't portable to gcj, at least until JNI becomes
available for gcj.

An alternative is one of the pure Java databases, which can actually
perform quite well since they avoid the whole native code problem.

Drury Tim wrote:
> I was totally dismayed when I coded a Java/JDBC benchmark
> vs. a C/C++/embeddedSQL benchmark.  The Java program was
> 200 times slower!  This was linear from 10 record inserts
> to 10000 record inserts.  I'm running on a Solaris 2.5
> machine.

-- 
Jeff Sturm
jsturm@sigma6.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]