Muncey Posted July 18, 2007 Share Posted July 18, 2007 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? Quote Link to comment Share on other sites More sharing options...
clanstyles Posted July 18, 2007 Share Posted July 18, 2007 I would do it that way but im not an expert. Quote Link to comment Share on other sites More sharing options...
lewis987 Posted July 18, 2007 Share Posted July 18, 2007 it will slow down but you probably wont notice it until you got about 5000+ people doing it (take a look at the "active users" on this site, i dont really see it slowing down) Quote Link to comment Share on other sites More sharing options...
Muncey Posted July 18, 2007 Author Share Posted July 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
clanstyles Posted July 18, 2007 Share Posted July 18, 2007 Besides if u have 5000+ People you will need a load balancer anyway...Get your own server and blah.. Load balancer there is a way to fix that lag. Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 18, 2007 Share Posted July 18, 2007 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). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.