Jump to content

Last Active


Muncey

Recommended Posts

If i was to make a last active field in a members table in my database and had it update the field every page they went on, would this effect anything like speed?

 

I was just thinking if say 100 people are using it at the same time and it's updating the database EVERYTIME someone clicks on a different part of the site, it may get a bit slow or something?

 

Will this happen or is it fine to do this?

Link to comment
Share on other sites

So is that how it's done on this site? If so that's enough for me to go ahead with it. The thing im making is very basic and will be improved, im just thinking of a way that will work but not cause too many problems for now.

Link to comment
Share on other sites

generally speaking, one sets an accuracy interval.  that is, it only updates the last active field in the database if the last recording took place x or more (minutes, hours, days) ago.  you update their last active in the database once they login, and set a session variable with that timestamp.  check the timestamp on every page they go to, and update the database again ONLY IF the timestamp is x or more interval old.  update that timestamp again.

 

in this way, you can grab everyone whose last active field was x or less interval old - it means they're online as accurately as the system can know.  increase the interval, you decrease the accuracy (because its updating less frequently).  this saves on resources a little more, for relatively little loss in accuracy (at, say, a 5 minute interval).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.