Are remote EJB calls, made from the same application server, always optimized as local, in-memory calls, and is serialization of data skipped in this scenario?
In other words, is it valid to work with remote EJBs all the time, thus achieving decoupling between application components, even if two+ EJB modules are deployed in the same container? I'm using Glassfish.
Also, if I have to do runtime lookup of the remote EJBs (I don't know the JNDI name of EJB until runtime), what is the best way to cache the calls, using as little as possible overhead on the existing EJB infrastructure provided by the app server (so, no additional libraries like Guice, just what Glassfish already offers).