I've been searching on the internet about using interval ajax polling for live web pages and I've been using it along with SignalR. Now I always read an article online about using ajax polling for live web pages that there could be an impact on your server or maybe there's a downside effect when using ajax polling if you have heavy traffic on your site and/or when you're polling large data from the database.If this would be true, I guess my questions are, what are the server impacts that they are talking about that could lead to any downside effect on your site? and how to avoid those server impacts if you choose to use ajax polling for your live web pages?
What are the impact to the server when using ajax polling for live web pages?
web development;performance;ajax;real time
The server impact is simply the request volume. Each time you poll the server, it has to handle the request. If you've got five widgets on your page and each one is polling for updates, that means that each user is generating five requests every second (or whatever your polling interval is). For many (possibly most) applications, this isn't a big deal, unless the requests cause a bottleneck on the server (e.g., if each request triggers a database read). However, if you're writing a commercial app that you hope will be used by thousands of people, it probably isn't a good idea. To mitigate the impact, you could implement some form of request throttling, increasing the polling delay when the system gets busy, but that's going to lead to some complex heuristics on the client side. As @Li Yin Kong suggested, you're better off using something like websockets for periodic updates.