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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri May 22 15:44:17 EDT 2009

Reading this with some attempt at fresh eyes suggests that "stateful"
and "stateless" are not exactly suggestive names for this difference.
For one, it is a server-centric view of something that is about both
clients & servers, and for two it isn't quite right (it only covers a
certain class of the state of a computation). Perhaps worth thinking
about other names?


On Fri, May 22, 2009 at 2:38 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.