Hi guys I need your opinion.I am in a situation where I need to use ajax so I need to query users info every 30 seconds.....which is more efficient query the server first(say check a text file first) and if there is an update for a user info, do a full blown database query or just directly query the database directly every 30 seconds.Please explain your reasoning so that I can weigh my decision.......thanks in advance.
I'd cache on the web server, lifetime of 30 seconds and pull all user data to minimize round trips to the DB. I'd also have the client use the web cache, not go to the database.
It's a lot of overhead for minimal gain otherwise
If you have a small number of users and few web clients, then implement the most simple solution.
Reasoning: There is no need to optimize something like this unless you have severe performance problems. I'd start thinking about this if:
But if you have 10 users, then this probably translates to 10 web browsers asking for this info every 30 seconds. You should worry about the poor CPU on your servers because it's going to be bored to death ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With