Polling behavior, and its alternatives
My programmer friends and I frequently observe that “polling behavior is evil” (it wastes resources when the polled query finds nothing). Here, I shall define polling behavior, and three alternatives.
- Polling (or “pull” when talking in comparison to “push”)
- Periodic querying of a source by the destination for objects. Example: POP email.
- Push
- The source blindly delivering objects to the destination (or at least trying to), regardless of the destination’s existence, presence, readiness, or capacity. Example: SMTP email.
- Request
- The destination asking the source for objects when they are needed, and no earlier. Example: Web browser.
- Subscription
- (Not in the RSS sense, which is polling.) The destination notifying the source—usually just by opening a connection—that it is ready for objects to arrive, and continuing to wait for further objects. Combines a request at the start of the subscription with push for the rest of the subscription. Example: IRC; instant messaging.