Reputation: 293
How to record user last activity datetime in mysql database? Is writing directly to database everytime user request a page a bad practice? Does this become problem on a high load website? How to reduce the writing load? Do i need cache (memcache,redis) ?
Upvotes: 2
Views: 851
Reputation: 108676
Writing a row to a log table per page is OK. If your idea of high traffic is hundreds of users, you won't have any problem with this. Keep your log table and its indexes simple.
Caching (memcache, etc) will help satisfy queries, but won't help with logging page views.
If you're talking about millions of users at once, you're moving into the highly scaleable realm. In that case you need to be exploring more elaborate solutions. But, get your system working, get yourself some users, and then address that problem.
Upvotes: 8