Say I have script, that does long polling on server to check if user has any new mesages. Server side would be something like this
while counter < 5
if something_changed
push_changes_to_client
break
else
counter++
sleep 5
Which checks database 5 times and every time if there is no change, it waits 5s untill next check, which results in maximum execution time of about 25s.
What happens when client moves from one page to another really fast? I suppose the server script keep on running even after client move to different page, where it sends another request for changes.
Does this mean, that when lot of people are moving quickly around the site (less than the 25s max execution on each page), then the server has to keep running all the scripts, that are trying to respond to page that doesn't exist any more? Wouldn't this cause the server to use all of it's thread pool pretty fast?