> So if you retrieve a large amount of data and also if you get larger
number
> of requests , your server may go out of memory. Surely storing the data in
> session works faster (obviously) but it is not very scaleable.

I agree in the common case, but a servlet container can be made smart enough
to only keep it in memory while there is memory available, and use disk when
the loads get high.  Unfortunately, that would like be a proprietary
solution, since I don't think there's anything like EJB passivate for
servlet session objects.  If there were, you could store to disk yourself
when the container needed memory, and then read back when it's needed.

Regardless, if your site is small (and more are!), you will not even see a
problem because of virtual memory, etc., presuming you pay a few bucks and
have 512MB or 1GB RAM.  If you have to be big, then stateless is the way to
go.  People complain about performance of going to the DB, but all massive
transactional systems demand the db be used, and there are ways to handle
that with clustering, db partitioning, load balancing, etc., and you don't
end up holding data for 30 minutes (or whatever you configured session
timeout to be) after each user leaves your site.  Also, session state has
many problems if the user opens to windows to your web site and is
traversing with both of them, since your "state" will not be able to track
the fact that they are doing more than one path through your site.

David

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to