I tried to use client and JSP to call a remote interface EJB located on the same machine. The remote EJB then call the local interface EJB giving out advice as that in HFEJB advice example. I found it takes about a second for the client to return the advice, while the browser version invoking the JSP returns the advice almost immediately. I wonder if anybody else has experience on this and what's the possible reason for the speed difference. Thanks.
Tong, There may be alot of reasons why this is happening. For example, where is the JSP container? Is it the same server as the EJB container? How many "hops" away from the EJB is the JSP container and remote client? And so on. Now that's about of the way--remember that as far as EJB is concerned, JSP and a regular Java program client are the same. They're just clients using the beans--nothing special. The bean is going to accessed exactly the same way for each of them (assuming they're both actually remote). It's not as if JSP will be able to truly access a remote EJB faster simply because it's a JSP document.
Thank you Nathaniel. My client, JSP and EJB(remote interface and local interface)s, and J2EE RI (web and EJB containers) are located on the same physical machine. I don't understand why it takes significant longer for client access than JSP access. [ April 19, 2004: Message edited by: Tong Lin ]
Hi Tong Lin: There are a lot of factors for the boost; some of which might not be very glaring to an appliction developer. As a matter of fact, some EJB vendors built their containers such that when the client or JSP is co-located in the same container(or server) with the EJB, even when the call is a remote call, it does not have to wonder to the internet to search for a bean which is right under its nose; since the JSP and EJB are deployed together; it is possible for the container to treat all like local calls(even though they are remote calls) thus enhancing the speed tremendously as against a client which does not share the container with the bean; thus will be treated as a remote call. this is just one example; there are other reasons out there which yours sincerely do not know. Question: What type of client is this client of yours; I think thin and thick clients have different effects on loading as well as speed of processing; that be the case; thick clients might be slower compared to thin clients - not very sure on this, raised it so more knowledgeable people could comment on it.