View Single Post
Old 07-01-2019, 07:44 AM  
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,102
Quote:
Originally Posted by NatalieMojoHost View Post
Ajax is a good solution if there are no load issues.

One caveat I'd point out there is that UPDATE queries tend to be quite heavy on a database, especially if you're dealing with hundreds of users online at any time, or updating on a large table. If the information does not need to be persistent, I would update something like a memcached key or redis object for each user, as those are much less intensive than running updates in SQL. Redis could be configured to save the changes to disk every X writes/minutes for some amount of persistence as well (though not as reliably as SQL, and then that's another database service you need to maintain/backup/etc) - just something to consider.
If it is a busy site, I think it would be better to use websockets for this kind of thing, and Redis to persist data.
That's true, however, if you use proper indexing in the database it can work out pretty good. For instance, I have a cam model site with over 340k models and one single query took me about 60+ seconds before indexing.. once the database was indexed properly, the queries are done withing 1 second.. but true, if there are 1000+ users online, the database may crash..
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote