aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB performance due to remote call confusion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB performance due to remote call confusion " Watch "EJB performance due to remote call confusion " New topic
Author

EJB performance due to remote call confusion

Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98

I was trying to improve the performance of an EJB call . I want to understand how many remote call ejb client makes to get the actual object .
If following are a general steps then is it true that client call two time remote call at the time of look up and at the time of create ? Can any body explain this steps

InformerHome home= (InformerHome)ctx.lookup( "ejb/informer" );
Informer informer = home.create();



// get handle into the EJB naming directory
InitialContext ctx = new InitialContext();

// get hold of the object you want by name
InformerHome home= (InformerHome)ctx.lookup( "ejb/informer" );

// get reference to business interface from home interface
Informer informer = home.create();

// use the business interface
informer.getTheTime() ;

Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 471
    
    1

I don't know in such detailed level what actually happens under the hood when you lookup and get a reference to a remote EJB, but it doesn't sound strange to me that there are actually two distinct calls to remote container.

Anyway if I'm not wrong, you may lookup once EJbs you need and then use their remotely exposed methods; so I don't think you should be worried a lot of how many remote calls in looking up phase are actually made. More likely, you should try to avoid a chatty usage of ejbs (if that's possibile, of course).
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
Can we conclude this way that when we are looking up for the JNDI it calls a remote machine and when we call the home.create of the home object it also gives a remote call ?
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 471
    
    1

I can say only that's likely to happen. To be sure, you can always intercept calls to remote server (using a tpc monitor or tracer listening on your appserver's rmi port) and see what happens at each instruction.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EJB performance due to remote call confusion