I\'m building a component of a web page that needs relatively constant database polling. I can see two different approaches for this, and I\'m wondering if one of them is better
Long polling will scale better (i.e. less server load) than polling, while giving much better response times.
If your recipient polls, the average journey time of a message will be half your poll interval.
With long polling, its instant - the server only waits if there is nothing to say.
If you are doing chat messaging, go long poll; its a usability thing.
The down-side with long polling is it is more complicated to implement; but its not that much more complicated, and it is widely implemented. So if you can't use an off-the-shelf framework for your webserver of choice, you can set about writing one reasonably and you will get it working.
You can also look at websockets, part of the newest browsers (or emulated via a Flash file you drop on your page)