*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Speed: Client vs. JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Speed: Client vs. JSP" Watch "Speed: Client vs. JSP" New topic
Author

Speed: Client vs. JSP

Tong Lin
Greenhorn

Joined: Mar 24, 2004
Posts: 12
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.
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
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.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Tong Lin
Greenhorn

Joined: Mar 24, 2004
Posts: 12
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 ]
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Tong,
Are your JSP and EJB both deployed in the same J2EE RI? If so, I'd say that's what's giving it the boost. If not, well maybe it's just voodoo black magic.
Tong Lin
Greenhorn

Joined: Mar 24, 2004
Posts: 12
Yes, both JSP and EJB are deployed with J2EE RI.
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
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.
Tong Lin
Greenhorn

Joined: Mar 24, 2004
Posts: 12
Hi Anselm,
Thank you for the reply. It makes sense.
My client is very thin. Does nothing but call the advice bean in HFEJB book.
[ April 26, 2004: Message edited by: Tong Lin ]
 
wood burning stoves
 
subject: Speed: Client vs. JSP