The only justification I've ever been able to see for using a DB to
store user session information is when the application is running in a
clustered environment. In every other case it is enormously faster and
more efficient to use memory. The semantics of which scope you put the
data in, and how you manage reads and writes are application specific,
but they generally follow this principle:

Start of request - Copy session data to a non-shared scope.
At every exit point (cfabort,cflocation etc.) - Copy data back to shared
scope.
At end of request - Copy data back to shared scope.

Spike


Stephen Milligan
Team Macromedia - ColdFusion
Co-author 'Reality Macromedia ColdFusion MX: Intranets and Content
Management'
http://spikefu.blogspot.com

> -----Original Message-----
> From: Robertson-Ravo, Neil (REC) 
> [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com] 
> Sent: 07 November 2002 11:51
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] Online Users
> 
> 
> I never said it wasnt :-) what I am saying is that the 
> application scope should be set little and read lots........  
> Its not ideal to write to the app scope everytime a new user 
> logs in/out.
> 
> If I use a db, I have one query to make which adds them to 
> the table, and I have one query to remove them on 
> logout....simple and fast.
> 
> I am sure that constant read/read of the applicaion scope is 
> a degrader (but the fact you cannot get all user sessions is 
> a real arse in CF, well not natively)....
> 
> As for speeding up the db, yes its pretty fast!
> 
> N
> 
> -----Original Message-----
> From: Russ Michaels [mailto:snake@;snakepit.net]
> Sent: 07 November 2002 10:43
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Online Users
> 
> 
> Do a test neil. It is a known fact in the I.T industry that 
> memory is faster than disk.
> 
> > -----Original Message-----
> > From: Robertson-Ravo, Neil (REC)
> > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com] 
> > Sent: 07 November 2002 10:21
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [ cf-dev ] Online Users
> > 
> > 
> > I disagree I would say reading and writing to a DB would be
> > faster than consantly reading and writing to the Application 
> > scope (its using an SP
> > btw).   You certainly cannot say that its "massively slower 
> > than writing to
> > memory", cause thats not the case.
> > 
> > I have never liked using the application scope for such
> > intensive requests as I have always seen degredation in 
> > performance especially when the scope starts to grow and 
> > become more complex.
> > 
> > As for another way Russ, I told you, I am using a
> > table...(possible temp, I have not decided yet.).
> > 
> > Neil
> > 
> > 
> > 
> > -----Original Message-----
> > From: Steve Martin [mailto:steve.martin@;sequence.co.uk]
> > Sent: 07 November 2002 10:15
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ cf-dev ] Online Users
> > 
> > 
> > I'd still be interested to hear your rationale on why
> > updating an application structure would be v.bad wheras you 
> > are happy to dump this info in a db which is massively slower 
> > than writing to memory.
> > 
> > > -----Original Message-----
> > > From: Robertson-Ravo, Neil (REC)
> > > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com]
> > > Sent: 07 November 2002 10:09
> > > To: '[EMAIL PROTECTED]'
> > > Subject: RE: [ cf-dev ] Online Users
> > > 
> > > 
> > > erm..... like I said, yes I know that can be done but with the 
> > > possibility of 600K users online at one time and the Application
> > > structure being written
> > > and read many times its not ideal........ in fact it would be 
> > > extremely
> > > unwise to do so.......
> > > 
> > > 
> > > -----Original Message-----
> > > From: Paul Fennell [mailto:paul@;satachi.com]
> > > Sent: 07 November 2002 10:07
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: [ cf-dev ] Online Users
> > > 
> > > 
> > > bung that info in to an application strc then
> > > wrap it and lock it
> > > 
> > > 
> > > 
> > > -----Original Message-----
> > > From: Robertson-Ravo, Neil (REC)
> > > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com]
> > > Sent: 07 November 2002 09:56
> > > To: '[EMAIL PROTECTED]'
> > > Subject: RE: [ cf-dev ] Online Users
> > > 
> > > 
> > > :-)
> > > 
> > > I need to have a list of ALL users logged into the system at one 
> > > time... I log their UserID, time of login etc...
> > > 
> > > N
> > > 
> > > -----Original Message-----
> > > From: Steve Martin [mailto:steve.martin@;sequence.co.uk]
> > > Sent: 07 November 2002 09:53
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: [ cf-dev ] Online Users
> > > 
> > > 
> > > OK, let's look at this again, from the top. What specific user
> > > information do you require and for what purpose?
> > > 
> > > > -----Original Message-----
> > > > From: Robertson-Ravo, Neil (REC)
> > > > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com]
> > > > Sent: 07 November 2002 09:19
> > > > To: '[EMAIL PROTECTED]'
> > > > Subject: RE: [ cf-dev ] Online Users
> > > > 
> > > > 
> > > > LOL :-)
> > > > 
> > > > OK Steve,   What I can't see from your suggestion is this : 
> > > > how do I get
> > > > *all* of the users into the session scope? of course I 
> understand 
> > > > fully how to get them into the application scope (to be shared) 
> > > > but I am unsure on how
> > > > you get all of the users into a session scope which can then 
> > > > be queried.
> > > > Surely each users session is independent?
> > > > 
> > > > Neil
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Steve Martin [mailto:steve.martin@;sequence.co.uk]
> > > > Sent: 06 November 2002 17:47
> > > > To: [EMAIL PROTECTED]
> > > > Subject: RE: [ cf-dev ] Online Users
> > > > 
> > > > 
> > > > By who's criteria?
> > > > The session scope is there for storing login 
> information of this 
> > > > nature. Slam in some RAM if you feel that your server 
> can't cope. 
> > > > 600 users is a
> > > > pretty teeny weeny small number by any server's standards.
> > > > 
> > > > My usual advice is to avoid trying to come up with
> > esoteric software
> > > > engineering solutions to workaround physical constraints
> > when such
> > > > constraints can be overcome by spending 50p on some more memory.
> > > > 
> > > > > -----Original Message-----
> > > > > From: Robertson-Ravo, Neil (REC)
> > > > > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com]
> > > > > Sent: 06 November 2002 17:12
> > > > > To: '[EMAIL PROTECTED]'
> > > > > Subject: RE: [ cf-dev ] Online Users
> > > > > 
> > > > > 
> > > > > well,, after a quick check, the amount of users within the 
> > > > > system could be
> > > > > 600+ at anyone time.....
> > > > > 
> > > > > bit big for the session scope?!
> > > > > 
> > > > > 
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Steve Martin [mailto:steve.martin@;sequence.co.uk]
> > > > > Sent: 06 November 2002 16:44
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: RE: [ cf-dev ] Online Users
> > > > > 
> > > > > 
> > > > > I just store login information in the session scope 
> which takes 
> > > > > care of flushing itself when the timeout is reached. Why
> > > > specifically are you
> > > > > storing such information in a db?
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Robertson-Ravo, Neil (REC)
> > > > > > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com]
> > > > > > Sent: 06 November 2002 16:31
> > > > > > To: '[EMAIL PROTECTED]'
> > > > > > Subject: [ cf-dev ] Online Users
> > > > > > 
> > > > > > 
> > > > > > This is a no brainer and I must be having a brain fart....
> > > > > > 
> > > > > > We have an online table which holds records for each user 
> > > > > > logged onto the system after login.
> > > > > > These rows have a date logged on etc, and indeed this works 
> > > > > > well when the
> > > > > > user signs off as expected (as this removes the rows in 
> > > question)
> > > > > > 
> > > > > > however, what process do you guys have in place when a user
> > > > > > does NOT sign
> > > > > > off and simply closes the browser and does not return for 
> > > > a few days
> > > > > > later...?
> > > > > > 
> > > > > > It means that they remain 'online' in the DB......
> > > > > > 
> > > > > > What do you guys have in place... any ideas?
> > > > > > 
> > > > > > Neil
> > > > > > 
> > > > > > --
> > > > > > ** Archive: 
> > > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > > > 
> > > > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: 
> > [EMAIL PROTECTED] 
> > > > > For human help, e-mail: [EMAIL PROTECTED]
> > > > > 
> > > > > 
> > > > 
> > > > --
> > > > ** Archive: 
> > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > > 
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> [EMAIL PROTECTED] 
> > > > For human help, e-mail: [EMAIL PROTECTED]
> > > > 
> > > > --
> > > > ** Archive: 
> > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For 
> > > human help, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > --
> > > ** Archive: 
> > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For 
> > > human help, e-mail: [EMAIL PROTECTED]
> > > 
> > > --
> > > ** Archive: 
> > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For 
> > > human help, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > 
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > 
> 
> > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > 
> 
> > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > 
> 
> > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED] For human help, e-mail: 
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to