Forum Moderators: coopster
I'm working on this new website of mine. Making it really short: my clients poll the server every 2 seconds to see if anything changed. It's crystal clear that 2 seconds refresh rate can kill my server rather quickly. So, I thought of changing my code to use Keep-Alive requests with value of 300 seconds. That way, I will save lots of php code execution, mysql socket connections and such. The problem is, that now I will have lots of execution threads on server.
Question is, how is it done with php? I guess I will have to check my database and go sleep for a while. But what about the number of executed php scripts? How many do you think I can run? I'm looking for something with experience in this.
Currently I'm running on shared hosting, but I will probably move to a managed server at some point.
Thanks!
If those are optimized, this may be one of those situations where an AJAX-type setup would actually *save* bandwidth and CPU cycles. Instead of them refreshing the entire page every 2 seconds, you could have a javascript on the page "refresh" a lean PHP script that returns a "true or false" that something has changed. Then use javascript to automagically refresh the page only when something has changed.