In there I create CFCs to supplement CF's native application framework:
there's an Application.cfc, Session.cfc and Request.cfc.
The application.cfc has, as a property, a collection of session.cfcs and the
session cfcs are linked to the user's session and to the collection. The
session cfc stores things like the pages visited, user agent information,
resolution information and whatever else I'd like to dump in there.
When the user's session (the CF session) times out the session is (of
course) unlinked from there. However it still exists in the
application-based collection. I can use that collection to determine the
number of logged in users, see the pages that the users have been visiting
and control the users experience (if I want to). Since I know the user keys
I can easily add "personal messages" on a whim (although I've never done
this) that they would see on their page request and so forth.
Since the session information persists longer than the session itself this
also allows me to work with the data before it's destroyed: in other words
it makes end-of-session processing simple. The collection has an expire()
method that's run on a schedule. Session that have timed out are dissected
and their information stored in the database then destroyed.
This definitely means a performance hit on the page, but not at all an
extreme one. You can see session counts and page times (as returned from
getTickCount() in light grey text at the bottom of DepressedPress.com
(hosted at CrystalTech. I'm not sure of the exact hardware anymore, but it's
decent, mid-range hardware).
Those pages are doing a lot more than just session management (the
navigation is all dynamic, the clickstream is dynamic, the layout is all
dynamic, security permissions are being checked and so forth). A general,
content-only page takes between 100 and 200 ms to run. But if I display a
"blank page" that's only running the basic framework elements page times
head down to 40ms or so.
I'd still like to improve that, but it's definitely not too slow for a
lightly hit site like depressedpress.com
If you'd like to see the code let me know. I still consider it "beta", but
so far it's working okay (although I've still some bugs track down).
Jim Davis
From: Katz, Dov B (IT) [mailto:[EMAIL PROTECTED]
Sent: Monday, August 09, 2004 9:23 AM
To: CF-Talk
Subject: RE: Count logged in user sessions
Does anyone know the performance cost of things like the SessionTracker
code?
Without sessionTracker, I wanted to do something similar, but in my
case, I wanted to make a struct for each session, put it in the session,
and in the application, and then access it from both, for some realtime
updates. I have a site which gets 400K-500K page views a day, and I am
looking to minimize the impact of advanced session management.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

