jacksonh / manos

Manos is an easy to use, easy to test, high performance web application framework that stays out of your way and makes your life ridiculously simple.
Other
455 stars 61 forks source link

Design for Session State management #98

Closed toptensoftware closed 13 years ago

toptensoftware commented 13 years ago

I realise that Manos currently doesn't include and session state management, but was wondering if anyone is working on this and whether there's been any thought into its design? I'm really going to need to this soon and I'm willing to write it myself but I want to make sure it fits with what's needed.

I'm familiar with ASP.NET's session state management which uses locking to ensure that only one client request per session can run at a time. I'm concerned that implementing something that blocks would have negative consequences for Manos and it's event driven model. Perhaps an asynchronous mechanism is required.

Thoughts?

ghost commented 13 years ago

Yes: roll your own for time being, but try to be more or less agnostic of the basis. With the current pipeline implementation (which will probably not be fixed in the very near future), such things are basically impossible without imposing some larger responsibility to maintain it upon the application.

So until that is fixed, session management will be a bit of a pain. Also, locking sucks :) Try to make your session immutable, more or less, and put any actions that change the session into the sync queue or something like that. With a method to wait for all outstanding changes, that behaves a lot like a lock without actually locking anything.

toptensoftware commented 13 years ago

Thanks myeisha.

I've coded up simple in-memory session state that avoids locking by simply storing on a last-in overwrites basis. Seems to be working fine so far...

Brad