Re: pl/Ruby, deprecating plPython and Core

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Dave Cramer <pg@fastcrypt.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>, "Joshua D. Drake" <jd@commandprompt.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, David Fetter <david@fetter.org>
Date: 2005-08-17T14:00:57Z
Lists: pgsql-hackers

Dave Cramer wrote:

> As there are two java procedural languages which are available for  
> postgreSQL Josh asked for an explanation as to their differences.
> They are quite similar in that both of them run the function in a  
> java vm, and  are pre-compiled. Neither attempt to compile the code.
>
> The biggest difference is how they connect to the java VM.
>
> PL/Java uses Java Native Interfaces (JNI) and does a direct call into  
> the java VM from the language handler.
>
> PL-J uses a network protocol to connect to a java VM.
>
>
> There are advantages and disadvantages to both approaches.
>
> + JNI is simpler, doesn't require a protocol, or an application  
> container to manage the User Defined Functions
> - JNI requires that the vm runs on the server machine, and a separate  
> vm be instantiated for every connection that calls a function.
>     This is mitigated somewhat in java 1.5, by sharing data, however  
> this may or may not be a Sun only feature ( does anyone know );
>     either way a separate vm is required for each connection.
> - startup time for the vm on the first call for the connection.
> - Possible ( not as likely any more ) for the java VM to take the  
> server down.
>
> Using a network protocol such as a pl-j does  has the following  ( 
> basically the opposite of the JNI (dis)advantages )
>
> + The java VM does not have to run on the server.
> + Only one vm per server
> -  More complex, requires a micro kernel application server to manage  
> the UDF's  currently http://loom.codehaus.org/
>
>

That's a pretty good explanation and ought to be published more widely. 
It's almost a pity that we couldn't have one project with a server 
setting saying how we want it to run.

I seem to recall hearing of a Sun gadget in the works that would let a 
process connect to a running VM and load classes and run them. I have 
been a bit out of it on Java lately - does anyone know of such a thing, 
or is my memory failing again?

cheers

andrew