I have a web application that uses very “live” data, so it needs to be updated every 1 second if something has changed.
I was wondering what are the pros and cons of the following solutions.
Solution 1 - Poll Lot
So, every 1 second I send a request to the server and return some data. As soon as I have the data, I wait 1 second before doing it again. I would discover the client side if the state changed and took appropriate action.
Solution 2 - Block A Lot
So, I run a request to the server, which will time out after 30 seconds. The server monitors the data on the server, checking it once a second. If the server notices that the data has been changed, it sends the data back to the client, which makes the actions accordingly.
Scenario
Essentially, the data are quite small in size, but vary at random intervals based on live events. Is the fact that the web interface will run something in the 2000 instance area, so do I have 2000 requests per second coming from the user interface or do I have 2000 long requests that take up to 30 seconds?
Help and advice would be greatly appreciated, especially if you have worked with AJAX requests in similar volumes.
source share