<snip>

>
> Some other respondees propose keeping the state closer to the client for
> speed. This argument begins to fall apart when those clients
> require access
> to other resources, such as database servers, and more importantly EJB
> servers. If an HttpSession object is holding multiple references to EJB
> handles, you may want to consider a SFSB. Speed and efficiency is achieved
> when the bulk of inter-process communication is reduced. This has
> little to
> do with where state is maintained.
>

The above option is very simplistic in assuming that there is 1 EJB server
serving out the needs of the Enterprise.
When talking about distributed systems, for example, it is generally assumed
that there are many multitudes of servers, both servlet engines and EJB
servers, with beans residing on multiple servers. Thus the above argument
falls apart when there are multitude of EJB servers in a cluster where there
is not much inter-process comms to optimise. These comms have to happen.
They might as well happen from the client onwards. Even if I was to use a
facade pattern to wrap my other beans, I would use a SSB.
In fact, I always have to assume that beans live on different containers in
my current project.

The general theory is that the servlet engine is already maintaining state
as part of the HttpSession object. It is part of the spec. The servlet
engine is going to create this even if you don't use it. Thus, if you can
put it there, you will achieve best performance generally. If you have a
SFSB, then you have the extra overhead of another object for each concurrent
client.
Now, you have to trade off over if the memory used in the EJB
container/server is important for you or the session object which the
servlet engine automatically creates is important. Your choice.
I always feel comfortable in using what the app server provides than writing
something myself though.

Though the above is a guideline, there are the usual caveats. If you have 1
servlet engine, 1 EJB server and low throughput, then you can merrily use
state everywhere. (even in the database, aargh!!)

Where SFSB is an ideal choice is when you have clients other than servlets
coming into the picture.

-- Aravind

===========================================================================
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".

Reply via email to