Caching home and/or remote interfaces

Discussions

EJB programming & troubleshooting: Caching home and/or remote interfaces

  1. Caching home and/or remote interfaces (4 messages)

    Hi,

    Is it safe to cache home and/or remote interfaces to improve performance?

    We are using J2EE 1.2 (EJB 1.1)

    BR
    Joacim
  2. yes.
  3. Yes...........Caching is OK.......

    There are some good thoughs on the matter here...

    Basic JNDI caching questions


    Steve


  4. A partial "yes".

    On the client, it is a good idea.

    On the server-side, it is less of a good idea (unless you are making remote calls). The reason being that there is not a lot gained on the serverside (but, I guess this depends a lot on your JNDI implementation).
    Secondly, it can lead to problems if it interferes with your ENC JNDI mapping - in particular if you are using the pattern implementation found on this site (a singleton cache object). Caching the home interfaces as instance variables is OK. Caching remote interfaces should only be done with care.

    In general, I have found that caching the InitialContext gives you the dominant part of performance benefit - and the gain you get thereafter by caching Home Interfaces is less significant.

  5. Hi,
    Thanks for your responses.

    We are developing a J2EE framework that will hide the JNDI lookups and getting home/remote interfaces (among lots of other things). We are using an extended version of Service Locator Pattern from "Core J2EE Patterns". This framework will be used on both client side (primary web client) and in the EJB container to communicate between different tiers (in the case if the tiers is on different JVMs and/or machines).
    Yes, we are using a singelton instance to obtain the home/remote interfaces.

    The InitialContext is already cached.

    For now we are using WebSphere 4.01 but our framework are built to support any J2EE 1.2 compliant app server.

    I have looked around a bit and it's always some BUT :-)

    Regards
    Joacim