Understanding the concept of polling in programming

NicolasBrondinBernard

Author
@NicolasBrondinBernard

Polling is a technique that involves sending a request at regular intervals to check for the existence (or not) of new data. Discover its advantages and disadvantages compared to real-time.

Article published on 23/04/2025, last updated on 10/08/2026

Polling is a programming technique that involves regularly querying a resource or service in search of new information: every second, every minute, or every hour, for example.

We could translate it as "sondage" in French, but we exclusively use the English version of the term.

How does it work?

The principle of polling is relatively simple: a request is sent to a server or specific resource at regular intervals.

If the response contains new information, it is retrieved and processed.

If this is not the case, the application waits until the next check.

In the context of web development, for example, polling can be used for a messaging application that will query a server every 5 seconds to check if a new message (or a notification) has arrived.

Advantages

Polling has two main advantages:

  • Simplicity: Polling is easy to implement, and can be used in situations where more complex technologies, such as WebSocket, are not necessary.
  • Compatibility: It can be used with any type of server or service, even those that don't support real-time communication protocols.

Drawbacks

But there are also two drawbacks not to be overlooked:

  • Server load: Polling can lead to overload on the server, especially if many applications frequently query the same resource.
  • Latency: Since data is only retrieved at regular intervals, there can be a delay before the user receives the most recent information.

Alternatives

Technologies like sockets allow you to establish real-time communication, thus reducing the need to resort to polling.

It's up to you to decide which system is best to implement, depending on your project and your constraints!

In summary

Polling is a technique that involves sending a request on a regular basis to check for the existence (or not) of new data.

It's a viable and simple solution in many cases where real-time responsiveness isn't critical, but it must be used with caution, particularly to avoid performance issues.


Finished reading this article?
Our complete courses
Take it to the next level with our courses!

Complete courses, exercises and certificates to really learn programming!

4.8 average rating

Comments (0)

to leave a comment

No comments yet