You could reduce the 300ms by caching the value in your session bean.
example of getB()
private BHome _bhome;
public void setSessionContext(SessionContext context) {
_context = context;
try {
InitialContext ctx = new InitialContext(); // no proprietary code
_bhome =
(BHome)PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/b"),BHome.c
lass);
} catch (NamingException e) {
throw new EJBException(e);
}
}
private BBean getB() {
_bhome.create(); // in fact this value could also be cached depending on
its usage and type, probably better off moving to foo().
}
This should get rid of your 300ms for each foo call to the same session
bean. Also your create seems a bit high I usually come out under 45 ms from
a client (in separate jvm), my ejb container is IAS 4.0 whats yours.
If B (assuming a session bean) is not created with any specific parameters
you might as well cache it. Thus incurring the cost of creation of 125 ms to
only one call.
William Louth
> -----Original Message-----
> From: Jes�s Vi�uales Bueno [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, February 25, 2000 10:13 AM
> To: [EMAIL PROTECTED]
> Subject: Re: What should be done where?
>
> James Cook wrote:
> > Is this *really* a "best practice" scenario? In my ejb test environment
> this
> > lookup process is averaging 200ms per business method!?
>
> Sean Brydon wrote:
> >
> > So, once the reference is obtained, it is kept for the entire Session,
> instead
> > of doing a lookup in each method call. It executes the lookup just once
> in
> the
> > EJBUtil.getShoppingCartHome() call.
> >
> > I hope that helps.
> > Sean
>
>
> Ok, now please think in the following scenario:
>
> Stateful Session Bean A with one foo() method. This foo() gets remote
> references to other 2 beans, (B and C) and invokes their foo() methods:
>
> public class ABean extends SessionBean {
> public void foo() throws RemoteException() {
> B = getB();
> C = getC();
> B.foo();
> C.foo();
> }
> }
>
> getB() and getC() methods lookup for the homes and invoke create methods,
> use cache mechanisms, bla, bla, bla.
>
> Even if we make use of cache mechanisms inside a session, the lookups and
> creates will be needed at least once per session, so:
>
> With the application server I use in my test environment I get the
> following
> time results (all the beans execute in the same computer)
> Lookup average : 300 ms
> Create average : 125 ms
>
> So, a remote client invocation to A.foo() would be 3*415ms = 1.25 sec
> !!!!!!
> And my sessions use to invoke only once to A.foo() [in fact the use to
> invoke only that method!], so the cache mechaninsms wouldn't help much in
> my
> scenario.
>
> What's wrong with that?
> I mean, the box is a Netfinity 5500 with 2 procs PIII-500 and 512 MB... so
> the problem isn't the computer (hope so :-); I wont say the name of the
> App-server vendor, ok?
> I would like to know if those times are similar to other vendor's EJB
> servers; James was talking about 200ms in the lookup, so even for that
> time,
> the total invocation time would be very high!
>
>
> I would like to know if other people use two, three or more beans inside a
> bean method and what performance can we get with this.
>
>
> Thank you all very much; it's a very omportant problem for me so any help
> would be appreciated.
>
>
> Regards,
> Jesus
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".