public inbox for [email protected]  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Is it safe to use multi-threaded PL/Java in single-threaded postgres process?
Date: Sun, 13 Apr 2014 20:16:34 +0900
Message-ID: <5F50DAFCABA4426FA54E9D8D0B78B38B@maumau> (raw)
In-Reply-To: <A832684586A84610AD7173AB42138F38@maumau>
References: <30A6B4B499494CED93770BBC4835840C@maumau>
	<A832684586A84610AD7173AB42138F38@maumau>

Hello all,

it seems most likely that I will fail to convince my colleagues to use 
PL/Java.  The performance was not as good as I expected compared to running 
Java functions in a process different from postgres.  On RHEL6 with 
PostgreSQL 9.2.8, I got the following results when I ran 10000 UPDATE 
statements in a single transaction, excluding the time of BEGIN and COMMIT:

* PL/pgSQL: 20 seconds
* PL/Java: 22 seconds (see the attached BatchPL.java for processing)
* Standalone client running on the same server as the database server: 23 
seconds (see Batch.java, which does the same job as BatchPL.java)

I avoided the influence of I/O by setting:

wal_buffers = 16MB
checkpoint_segments = 100
checkpoint_timeout = 1h

So I couldn't insist that PL/Java is required to greatly reduce the overhead 
of interprocess communication and process context switches.  Any ideas?

Regards
MauMau
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Batch.java
Type: application/octet-stream
Size: 1237 bytes
Desc: not available
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20140413/61dea8a8/attachment-0002.obj;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BatchPL.java
Type: application/octet-stream
Size: 1204 bytes
Desc: not available
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20140413/61dea8a8/attachment-0003.obj;



view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Subject: Re: [Pljava-dev] Is it safe to use multi-threaded PL/Java in single-threaded postgres process?
  In-Reply-To: <5F50DAFCABA4426FA54E9D8D0B78B38B@maumau>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox