[plt-scheme] difference between stateful and stateless servlets, and which to use

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri May 22 15:38:00 EDT 2009

Hi Sigrid,

Perhaps we can figure out a better explanation for the documentation
after I test it out on you.

The only difference between stateful and stateless servlets is how
they handle the continuations that are executed when you browse to
URLs.

Stateful servlets store those continuations in a hash-table in the
server's memory.

Stateless servlets give those continuations to "stuffers" which
"stuff" them into the URLs themselves. In most cases this means
actually serializing the continuation into a string that is included
in the URL. However, with the hash-stuffer, it means putting the
continuation on disk and a reference in the URL.

All other state... whether that be database connections, images, or
floating point numbers... that are not part of the continuation are in
the server instance.

Ceteris paribus, you want stateless servlets because they use less
memory on the server. However, the stateless language imposes certain
constraints on you, so it is not always an option.

Jay

On Fri, May 22, 2009 at 3:33 PM, keydana at gmx.de <keydana at gmx.de> wrote:
> Hi all,
>
> to be honest, from the documentation it is not clear to me what the
> difference between stateful and stateless servlets is, and which I should
> use for my purpose. If I had to make a guess, I would perhaps assume that
> with stateful servlets, state is kept in memory between requests, whereas
> with stateless ones it would be always directly written somewhere, with the
> help of "stuffers"  - is this at least a littel correct?
>
> I 'd be very grateful for a short explanation of the real meanings, and also
> perhaps a hint which to use. I plan to write a simple web application, using
> snooze for the database handling. Up till now I'd imagined triggering the
> database operations "manually"
> (directly writing "save!" commands when necessary), but now I wonder if this
> would be the way to go only with stateful servlets, whereas with stateless
> ones I would pack this into a stuffer?
>
> Thanks a lot in advance for any help,
> Sigrid
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.