Highlight

Pooling, what polling? and why does it cost you?

Intro

If you build logic app solutions you might notice that many connectors have a setting which states soemthing like “Check every ‘X’ seconds”. This is basically what’s called pooling.

Polling is a very simple thing. If you ask wikipedia, this is the result

Polling, or interrogation, refers to actively sampling the status of an external device by a client program as a synchronous activity. Polling is most often used in terms of input/output (I/O), and is also referred to as polled I/O or software-driven I/O. A good example of hardware implementation is a watchdog timer.

In layman terms. Keep asking a web service until an event happens.

We sometimes jokingly call it “busy waiting”. Because you sort of wait for events, but you are busy because you constantly need to reach out to service to ask for the latest data and compare it against what you have in your state.

For example, check if a new file appears on sharepoint every 10 seconds is an example of polling.

Problem Statement

The problem with polling is that it costs. But it only consts for Azure/Consumption triggers. Not In-App triggers.

Why?

Everything boils down to.

Every time logic app performs an actions. You pay.

Simple. If you consider this as a baseline, then it’s easy to understand that when you are asking logic app to check sharepoint every 10 seconds to see if any new file appeared, then obviously you ask Azure service to perform a single (1) action every 10 seconds. So you need to pay for it.

If at some point a new file appears, then workflow starts. But those checks that you perform are paid for too.

Solution

There isn’t necessarily a solution here. This is mostly for awareness, but I can share few of my tips for cases like this

  1. Ensure polling schedules are only as often as they need to be, otherwise calculate how much triggering will cost your

    Standard Connector Per Call: $0.000125

    What does this mean for us?

    So, it costs 33 USD per month, for a single logic app to check sharepoint every 10 seconds. That’s quite a lot depending on your need. For 3 environments that’s already 100 USD.

  2. Check if there is a better trigger, some triggers use pub/sub (event-based triggering), example of triggers like this are

    • Event Grid instead of blob trigger
    • SharePoint (new connectors use graph subscriptions, hence are event based now, previously they were polling based)
    • Microsoft Teams (new connectors use graph subscriptions, hence are event based, previously they were polling based)
    • OneDrive (new connectors use graph subscriptions, hence are event based, previously they were polling based)
    • Microsoft Exchange/Outlook (new connectors use graph subscriptions, hence are event based, previously they were polling based)

Summary

Polling can be surprisingly expensive, so make sure to always check how they are configured, and match the need against the estimated cost.

Adam Marczak

Programmer, architect, trainer, blogger, evangelist are just a few of my titles. What I really am, is a passionate technology enthusiast. I take great pleasure in learning new technologies and finding ways in which this can aid people every day. My latest passion is running an Azure 4 Everyone YouTube channel, where I show that Azure really is for everyone!

Did you enjoy the article?

Share it!

More tagged posts