Hi Steven,
maybe we should add a method to the SessionManager interface
(setElementSupport) that is called by the authentication with itself
as the argument.
What do you think?
Geert
On 08 Sep 2006, at 21:46, Steven Grimm wrote:
Last night I implemented a custom SessionManager that uses
memcached as its backend. (memcached is a super-high-performance
distributed cache server.) One thing I discovered was that for each
request, I was doing three cache fetches from memcached and one
update, when I sort of expected to do just one fetch and one update.
The reason turns out to be pretty simple, but it's a potential
efficiency issue that anyone implementing a SessionManager should
be aware of, with or without my refactoring. For a page that just
extends identified.xml, the session manager's isSessionValid()
method is called, then, if that's successful, its getSessionUserId
() and its continueSession(). If you are fetching your session data
from a backing store on each of those calls, you will do three
fetches per logged-in request.
Absent any way for my SessionManager to get at a request-scoped
object to set an attribute on, I am now keeping a WeakHashMap to
cache my data for a very brief time (100ms, which is probably total
overkill) and with that in place, I now do one fetch and one update
against memcached per page request, as desired. The WeakHashMap
entry for a given authId gets cleared out explicitly whenever
there's a write operation.
By the way, if you want to see the session manager, I posted it to
http://rifers.org/paste/show/1726 and http://rifers.org/paste/show/
1727 -- it works, but plugging it in will be a bit of an ordeal for
you until my still-in-progress refactoring of RIFE's authentication
system hits the official source base. (See the devel list for
details about that; basically I'm making it much easier to plug in
custom authentication backends.) It depends on the Java memcached
client from http://www.whalin.com/memcached/ . At some point, after
my refactoring is done and integrated, I will probably try to
convince Geert to include some variant of this session manager in
RIFE, but one thing at a time!
-Steve
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users