You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by exabrial <ex...@gmail.com> on 2012/06/26 19:24:52 UTC

What protocol does OpenEJB use for RMI?

The Telephone example uses the following protocol URL:
"ejbd://localhost:4201"

First Question: Is the underlying RMI protocol JRMP, IIOP/CORBA or is ejbd a
separate wire protocol on it's own? I'm curious from a performance
perspective, as JRMP has been shown to be as fast as Hessian, both of which
is faster than IIOP/CORBA.

Second question: Is it possible to change the protocol which OpenEJB uses?

Thanks!

--
View this message in context: http://openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: What protocol does OpenEJB use for RMI?

Posted by David Blevins <da...@gmail.com>.
On Jun 26, 2012, at 11:39 AM, exabrial wrote:

> Thanks for pointing exactly where I need to look!
> 
> I'm relieved to see that the underlying protocol isn't CORBA/IIOP. It looks
> like is sort of a custom protocol. The request is encapsulated with a
> request type (auth, jndi, or ejb) then it's reading serialized java objects
> with ObjectInputStream. Overall, it's probably pretty danged fast.

At one point the protocol included custom ObjectInputStream/ObjectOutputStream implementations I wrote that *were* faster.  JVM optimizations put and end to that and instead of being 30% faster they were actually slower :)  So we pealed them out and reverted to the built-in JVM implementations.

But overall the protocol has been written with an intimate knowledge of serialization and attempts to avoid some of the chattier parts of it.  For example object serialization writes structure information about a class (once) then writes the data for that class (once per instance).  Generally speaking, we've cut out the structure part of all our objects and get straight to the data writing part.  So "our" portion of the communication is incredibly small leaving the rest for your objects.

It also supports sending a versioned list of server addresses for clustering support.  The client sends the version number on every request.  If the list has changed, the server sends back a new list & version with the regular response.

In general we try and keep state or similar things boiled down to a byte or long and only transmit "full" data when necessary.

If ObjectInputStream/ObjectOutputStream implementations weren't so expensive to maintain, I'd take another crack at writing a better one.  Basically, an OOS or OIS will cache both class and instance data.  The instance data is cached so that if you see a reference to the same object again you just write its id instead of writing the entire object.  Because there's instance data cached in the OOS and OIS instances, you have to throw them away and create new ones on each request.  This unfortunately throws everything away including the class descriptor data.  So if you 1000 requests using an object graph consisting of 30 objects you're writing effectively constant data 29970 times more than you need to.

The optimization would be to simply split OOS into two objects (two caches).  One to hold class descriptor cache -- this object you keep and reuse on every request.  And one to hold instance cache -- this one you create on every request.  

Then communication would naturally compress.  After the first few requests, you'd be done writing class descriptor data for the most part and only be writing instance data.

Anyway, I get way too into this stuff :)  If you were looking for something fun to hack on, this would be one of those cool areas.  Grabbing the OOS and OIS code from Harmony would be a great way to get started.  The it's just a matter of refactoring the code into a thread safe outter class to hold the class descriptor cache and a factory method to create an ObjectOutputStream which is really just an non-static inner class that can reuse the class cache and has it's own cache for instances.

> 
> It's not modular however, but the design is beautifully simplistic; I'd hate
> to see it get trashed with a pluggable handlers :(

Thanks very much :)  I like to think "tight and simple" describes OpenEJB overall, but definitely the protocol is one of my favorite parts of the code.


-David


Re: What protocol does OpenEJB use for RMI?

Posted by exabrial <ex...@gmail.com>.
Thanks for pointing exactly where I need to look!

I'm relieved to see that the underlying protocol isn't CORBA/IIOP. It looks
like is sort of a custom protocol. The request is encapsulated with a
request type (auth, jndi, or ejb) then it's reading serialized java objects
with ObjectInputStream. Overall, it's probably pretty danged fast.

It's not modular however, but the design is beautifully simplistic; I'd hate
to see it get trashed with a pluggable handlers :(

--
View this message in context: http://openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806p4655810.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: What protocol does OpenEJB use for RMI?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

The code is here:
http://svn.apache.org/repos/asf/openejb/trunk/openejb/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/

Using other protocols needs some hack from what i know.

- Romain
Le 26 juin 2012 19:25, "exabrial" <ex...@gmail.com> a écrit :

> The Telephone example uses the following protocol URL:
> "ejbd://localhost:4201"
>
> First Question: Is the underlying RMI protocol JRMP, IIOP/CORBA or is ejbd
> a
> separate wire protocol on it's own? I'm curious from a performance
> perspective, as JRMP has been shown to be as fast as Hessian, both of which
> is faster than IIOP/CORBA.
>
> Second question: Is it possible to change the protocol which OpenEJB uses?
>
> Thanks!
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: What protocol does OpenEJB use for RMI?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 4 janv. 2016 14:49, "nilesh.chauhan" <ni...@gmail.com> a écrit :
>
> Dear Romain,
>
> I guess my question is not clear. Following are my questions.
>
> 1) Is all the EJB3's deployed on TomEE is Corba/iiop compliance? I mean
need
> to expose EJB3 to Corba clients.

We dont integrate with corba by default

> 2) If not, what configuration/code changes required to make it Corba
> compliance?

Write the corba deployment as in hessian module

> 3) In case of Glassfigh, i can easily lookup the ejbs using few lines of
> corba properties settings in my standalone java client; which looks like
> following:
> *Properties props= new Properties();
> props.setProperty("org.omg.CORBA.ORBInitialHost","192.00.00.00");
> props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
> initialContext= new InitialContext(props);
> Object obj = initialContext.lookup("EJB JNDI NAME");*
> So, what is the way to lookup the EJB in that manner?
>

Same code with differznt properties using ejbd protocol, check the link i
pasted. If you have a reason to use corba you ll need to build the deployer
as mentionned but corba is not the only ejb remote protocol and will not be
mandatory in ee 8 cause considered legacy since years already.

> Thanks
>
>
>
> --
> View this message in context:
http://tomee-openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806p4677343.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: What protocol does OpenEJB use for RMI?

Posted by "nilesh.chauhan" <ni...@gmail.com>.
Dear Romain,

I guess my question is not clear. Following are my questions.

1) Is all the EJB3's deployed on TomEE is Corba/iiop compliance? I mean need
to expose EJB3 to Corba clients.
2) If not, what configuration/code changes required to make it Corba
compliance?
3) In case of Glassfigh, i can easily lookup the ejbs using few lines of
corba properties settings in my standalone java client; which looks like
following:
*Properties props= new Properties(); 
props.setProperty("org.omg.CORBA.ORBInitialHost","192.00.00.00"); 
props.setProperty("org.omg.CORBA.ORBInitialPort","3700"); 
initialContext= new InitialContext(props);
Object obj = initialContext.lookup("EJB JNDI NAME");*
So, what is the way to lookup the EJB in that manner?

Thanks



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806p4677343.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: What protocol does OpenEJB use for RMI?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Remoting client is explained on http://tomee.apache.org/clients.html

To use corba you need to write a tomee Service like hessian to deploy corba
services - hessian service can be used as template
https://github.com/apache/tomee/tree/master/server/openejb-hessian - but
you DONT need corba to do remoting.
Le 4 janv. 2016 14:27, "nilesh.chauhan" <ni...@gmail.com> a écrit :

> David Blevins-2 wrote
> > There's an API for doing that, yes.  OpenEJB has always had a strict
> > server/container contract so that exposing new protocols can be done
> > without modifying internals.  Geronimo supports a CORBA integration for
> > example.
> >
> > Doing so is a development task though, not a configuration task.
> >
> > -David
>
> Can i get some inputs to access the EJB deployed on TomEE with CORBA
> client.
> I want to deploy EJB3 into TomEE and need to access the same using java
> standalone client.
>
> Any inputs on the same in big help.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806p4677341.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: What protocol does OpenEJB use for RMI?

Posted by "nilesh.chauhan" <ni...@gmail.com>.
David Blevins-2 wrote
> There's an API for doing that, yes.  OpenEJB has always had a strict
> server/container contract so that exposing new protocols can be done
> without modifying internals.  Geronimo supports a CORBA integration for
> example.
> 
> Doing so is a development task though, not a configuration task.
> 
> -David

Can i get some inputs to access the EJB deployed on TomEE with CORBA client.
I want to deploy EJB3 into TomEE and need to access the same using java
standalone client.

Any inputs on the same in big help.

Thanks



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/What-protocol-does-OpenEJB-use-for-RMI-tp4655806p4677341.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: What protocol does OpenEJB use for RMI?

Posted by David Blevins <da...@gmail.com>.
On Jun 26, 2012, at 10:24 AM, exabrial wrote:

> The Telephone example uses the following protocol URL:
> "ejbd://localhost:4201"
> 
> First Question: Is the underlying RMI protocol JRMP, IIOP/CORBA or is ejbd a
> separate wire protocol on it's own? I'm curious from a performance
> perspective, as JRMP has been shown to be as fast as Hessian, both of which
> is faster than IIOP/CORBA.

It's a custom binary protocol that can be layered over a plain socket or HTTP, but for the most part is ObjectInputStream/ObjectOutputStream.

I'll note that the format of the protocol has almost no baring on the speed of the communication.  The biggest factors are connection handling/pooling, buffering and the size of the objects sent back and forth.

We did a considerable amount of work in that area a few years ago:

  http://markmail.org/message/uhur6td3lafxva5x

Should give some indication of the performance characteristics.

> Second question: Is it possible to change the protocol which OpenEJB uses?

There's an API for doing that, yes.  OpenEJB has always had a strict server/container contract so that exposing new protocols can be done without modifying internals.  Geronimo supports a CORBA integration for example.

Doing so is a development task though, not a configuration task.

-David