Alex Rivera | Logout

What is wrong with polling?

Asked 2008-11-26T10:52:20.953
42

I have heard a few developers recently say that they are simply polling stuff (databases, files, etc.) to determine when something has changed and then run a task, such as an import.

I'm really against this idea and feel that utilising available technology such as Remoting, WCF, etc. would be far better than polling.

However, I'd like to identify the reasons why other people prefer one approach over the other and more importantly, how can I convince others that polling is wrong in this day and age?

Edit
Report

3 Answers

25

There are two reasons why polling could be considered bad by principle.

  1. It is a waste of resources. It is very likely that you will check for a change while no change has occurred. The CPU cycles/bandwidth spend on this action does not result in a change and thus could have been better spend on something else.

  2. Polling is done on a certain interval. This means that you won’t know that a change has occurred until the next time that the interval has passed.

It would be better to be notified of changes. This way you’re not polling for changes that haven’t occurred and you’ll know of a change as soon as you receive the notification.

answered 2008-11-26T11:02:53.663
8

Client polling doesn't scale as well as server notifications. Imagine thousands of clients asking the server "any new data?" every 5 seconds. Now imagine the server keeping a list of clients to notify of new data. Server notification scales better.

answered 2009-04-09T17:39:18.877
3

The thing about polling is that it works! Its reliable and simple to implement.

The costs of pooling can be high -- if you are scanning a database for changes every minute when there are only two changes a day you are consuming a lot of resources for a very small result.

However the problem with any notification technoligy is that they are much more complex to implement and not only can they be unreliable but (and this is a big BUT) you cannot easily tell when they are not working.

So if you do drop polling for some other technoligy make sure it is usable by average programmers and is ultra reliable.

answered 2008-11-26T11:03:48.230

Your Answer