Polling
It's like a kid in the backseat asking, 'Are we there yet?' every single minute until you arrive.
Definition Polling is a communication method where a device or program repeatedly checks with another system at fixed time intervals to see if there is any new data or status update. Instead of waiting for the other side to notify it, it actively asks on a schedule to stay up to date.
Are We There Yet? How About Now? Asking Over and Over
Imagine a long family road trip where a child in the back seat keeps asking every minute, "Are we there yet?" The driver responds, "Not yet," every time until finally reaching the destination and saying, "Yes, we're finally here!"
Programs in computers and smartphones often work the exact same way. An app on your phone might incessantly ask the server on a fixed schedule whether any new messages or notifications have arrived. It repeatedly checks at set intervals, like every 1 or 3 seconds, asking, "Any new data?"
This technique where a device or software periodically checks the status of another system is called polling. Because its logic is straightforward and easy to implement, it has been a fundamental building block since the early days of electronics and software.
Simple, but Resource-Hungry
The biggest upside of polling is its simplicity. All you need to do is tell the system to run a query command at regular intervals, and it works reliably in almost any environment.
However, because it keeps asking the exact same question even when nothing has changed, it wastes computing resources and power. You might ask a hundred times, only to get ninety-nine useless "nothing new" replies. In the process, both the central processing unit (CPU) and network connections get needlessly overworked.
There is also a latency problem: you can't learn about updates instantly. If an important event happens right between two queries, you won't know about it until the next scheduled check. Shortening the interval drains the battery at warp speed, while lengthening it creates noticeable lag.
A Smarter Way: Interrupts and Push Notifications
To fix this inefficiency, modern computer systems often use an "alert only when needed" approach. Instead of you knocking on the door every few seconds, the other party rings the doorbell only when there is actual news.
In computer hardware, rather than having the CPU constantly monitor every peripheral, devices fire a signal only when an event occurs, like a mouse click or keystroke. This mechanism is called an interrupt.
Software and web browsers follow a similar principle. Instead of blindly pinging the server for chat messages, apps use WebSockets or real-time push notifications that keep a persistent channel open. This lets your device conserve battery while still receiving updates at lightning speed.
๐ค Common misconceptions
Polling is so inefficient that modern computers and web apps never use it anymore.
Polling is still actively used wherever simplicity and bulletproof reliability matter most. For instance, reading fine-grained sensor data on hardware, simple embedded devices without complex networking stacks, or batch processing jobs often rely on polling as the safest and cleanest solution.
๐งบ Where you meet it
Polling is a communication method where a client repeatedly asks a server at set intervals to check for updates or new data.