Webhooks vs Polling vs Queues: Choosing the Right Integration Pattern
Every integration starts with the same question: how does my system find out that something happened in another system? There are three common answers. Ask repeatedly (polling), get told (a webhook), or put the news on a queue and process it when you can. People choose between them by habit, and then discover the cost in production: a polling job that burns through an API quota, or a webhook endpoint that silently loses events during a deploy.
This guide compares the patterns with a small simulation you can run yourself, then gives a default that works for most business integrations.
What this article is, and is not
The numbers come from a simple model of one day, run in PHP 8.3 with a fixed random seed so you get the same output. It is a model, not a benchmark: events happen at random seconds, polls happen on a fixed schedule, and I assume the sending system retries a failed webhook for ten minutes and then gives up. Real providers differ in their retry rules, in how long delivery takes and in their polling limits, so read your provider's documentation. The outage figures in particular depend on that assumption.
The three patterns
| Polling | Webhook | Queue |
|---|
| How it works | You ask the other system on a schedule: "anything new since last time?" | The other system calls your URL when something happens | Incoming work is stored and processed by workers at their own pace |
| Delay before you know | Up to one polling interval | Seconds, normally | Adds the time the work waits in the queue |
| Load on the other API | Constant, whether or not anything happened | About one request per event (to you, not to them) | None by itself |
| Loses events if you are down? | No, if you use a "since" cursor | It depends on the sender's retry policy | No, once the event is stored |
| You need a public URL | No | Yes, and it must be secured | Not for the queue itself |
| Hard parts | Choosing the interval, staying under rate limits, remembering the cursor | Verifying signatures, handling duplicates and out-of-order events | Retries, ordering, a place to see failures |
The queue is not an alternative to the other two. It is what sits behind either of them. A webhook that stores the event and answers quickly, and a polling job that stores what it found, both hand the work to a queue.
What polling costs
With 500 events spread over a day, here is what each polling interval gave:
| Poll every | Mean delay | 95th percentile | Longest delay | Requests per day | Requests that found nothing |
|---|
| 10 seconds | 4.3 s | 9 s | 9 s | 8,640 | 8,149 |
| 60 seconds | 29.1 s | 56 s | 59 s | 1,440 | 1,011 |
| 300 seconds | 143.4 s | 284 s | 298 s | 288 | 50 |
| 900 seconds | 433.8 s | 851 s | 898 s | 96 | 0 |
The mean delay is roughly half the interval, which is what you would expect. Polling every ten seconds to get news about four seconds sooner used 8,640 requests, of which 8,149 returned nothing. A webhook for the same traffic is about 500 requests.
The picture changes when events are rare. With only ten events a day, polling every minute made 1,440 requests and 1,430 of them found nothing, which is 99.3% wasted. Polling every five minutes made 288, still 96.5% empty. If you pay per request, or the API has a quota, rare events are where polling is most wasteful.
What a webhook costs
A webhook saves requests and removes most of the delay. The price is that you must run a public endpoint that is always available, secure it and deal with duplicates. It also depends on the sender, who decides how long to retry. Consider a 30-minute outage of your endpoint in the middle of the day, when ten of the 500 events occur. Under my assumption that the sender retries for ten minutes and then gives up, six of those ten events were lost. With polling and a cursor, none were: the next poll after the outage fetches everything since the cursor.
That is why "use webhooks" is incomplete advice. A webhook is fast and cheap, and it can have gaps.
A default that works: webhook, queue and a safety-net poll
Provider --webhook--> your endpoint --stores event, answers 200--> queue --> workers
^
Scheduler --every few minutes: "anything since my cursor?"----------------+
(stores anything the webhook missed; duplicates are ignored)
- The webhook is the fast path. Verify the signature, store the event with a unique key, answer at once. My guide to building a signed webhook receiver in Laravel shows how.
- A queue does the work, with retries and a record of failures, as in my guide to queue jobs for third-party APIs.
- A slow poll is the safety net. Every few minutes it asks the provider for anything since the last cursor and stores what it finds. Because events are stored under a unique key, an event that the webhook already delivered is simply ignored.
Under the same outage scenario, that combination lost none of the ten events, because the poll after the outage found what the webhook missed. You pay for the poll's requests, but at five-minute intervals that is 288 a day, which is small, and it does not need to be fast.
How to choose
| Your situation | Reasonable choice |
|---|
| The provider offers webhooks and a way to list recent events | Webhook plus a slow reconciliation poll |
| The provider only offers an API to list changes | Poll, with a cursor, at the slowest interval you can accept |
| A few people tolerate waiting minutes, and the API is cheap | Polling is simpler. Do not build webhook infrastructure you do not need |
| Events are rare but must be handled fast | Webhook, with an outage plan |
| Bursts of events, or slow processing | Put a queue behind whichever you choose |
| You cannot expose a public URL | Poll, or use an intermediary that can receive webhooks for you |
What the model does not cover
- Delivery delay. A webhook arrives in however long the sender and the network take. I did not model it.
- Ordering. Neither pattern guarantees events in order. Design handlers that do not depend on it.
- Real provider behaviour. Retry windows, signature schemes, rate limits and event history all differ. Read the documentation, and test with your provider's real events.
- Cost. Request counts are not prices. Multiply by what you pay, if anything.
Run the simulation yourself
The core of it is a few lines. The first poll at or after an event is the moment it is noticed:
foreach ($times as $t) {
$next = (int) (ceil($t / $interval) * $interval); // the first poll at or after the event
$delays[] = $next - $t;
}
Change $events, the intervals or the outage window to match your own traffic, and keep the seed fixed so that runs can be compared.
Common mistakes
- Polling very fast and burning quota to save a few seconds.
- Relying on webhooks alone with no way to recover missed events.
- Forgetting the cursor, so every poll reprocesses everything or misses things.
- Processing inside the webhook request instead of storing and queuing.
- Ignoring duplicates, which both patterns produce.
- Building webhook infrastructure for something a five-minute poll would handle.
Frequently asked questions
Is polling bad?
No. It is simple and recoverable, and it is the right answer when delay does not matter or webhooks are unavailable. The mistake is polling fast for no reason.
How slow can the safety-net poll be?
As slow as you can accept an event being late if the webhook failed. Five to fifteen minutes is common. It is a business decision, not a technical one.
Do I need a queue for low volume?
The queue's main value is retries and visibility into failures, not speed. For anything that can fail, such as calling another API, it is worth having even at low volume.
What about tools like n8n or Make?
They can receive webhooks and run scheduled polls. The same trade-offs apply, and you still need to handle duplicates and decide what happens when they are down.
Where this fits
If you are connecting systems and want the integration to survive outages and duplicates, see API Integration & Custom Automation, or describe your integration here. More guides on this topic are collected under AI Integrations.