We built something like this as part of an anti-data-mining script.
Basically, we kept a structure in the Application scope that was a pool of
Session IDs (keys) and last time visited (values). When each page was hit
this time was updated and there was a chance that a "garbage collection"
routine would be run. This routine just looked through the structure to see
which sessions had timed out and removed their associated keys. Since this
was done often (about once a minute) it added minimal overhead and generally
wasn't even noticeable. (The garbage collection took less than 10ms in most
cases.)
We eventually even extended it to track the last 10-15 URLs on our site that
the user had hit, which we then used to figure out how we could better
organize our site. We also added a real-time viewing interface to it so
that you could see what sessions were active, what pages they'd hit, and how
quickly they were traipsing through the site. This made the bean-counters
*extrememly* giddy, as they now had visible real-time proof that the site
was doing what it was supposed to.
The anti-data-mining portion was simple, too. Since we knew the last couple
of hits that the user had done, if they were searching our database too fast
then we knew they weren't human and "froze" the session for a minute.
During that time they wouldn't see anything but a nice "please slow down"
page. We've only trapped 2 or 3 actual humans since we started it. We have
trapped a few offline browsers/caching clients, but that's okay with us, as
our data is meant to be real-time anyway.
The whole thing wasn't more than about 200 lines of code. It's absurdly
simple to implement. Just make sure your locking is all worked out. :)
-Rick
-----Original Message-----
From: AustralianAccommodation.com Pty. Ltd.
[mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 22, 1999 4:21 PM
To: [EMAIL PROTECTED]
Subject: How To Create A Live Session Counter
I am wanting to create a live session counter so that at any time I can
determine how many users are logged onto my website. Rather than being a
counter that counts new sessions it also needs to detect closed sessions
that have closed / timeout so that the value of the counter is a true
representation of those sessions that are active at any time
I look forward to your input in this matter and thank you in advance
Kind Regards
Claude Raiola (Director)
AustralianAccommodation.com Pty. Ltd.
Website: www.AustralianAccommodation.com
Email: [EMAIL PROTECTED]
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.