Why Event Grid is a game-changer for Serverless
Remember when “Send/Receive” used to be one of the most prominent and most pressed buttons in Outlook? Or when it would sometimes take 30 minutes before an email showed up on your phone? Sometime in the early 2000’s there was an important shift so emails now show up on our smartphones the instant they arrive, and a similar important shift is happening in the Serverless space.
TFW you are waiting for mail and frantically clicking this button over and over
Azure Event Grid was announced this week as the first event-based router as a service, but the impact this service can make isn’t quite understood by everyone. In my mind one of the largest benefits is it makes it easy for any developer to utilize the “push” model instead of the inefficient “pull” across their Serverless architecture. “Pull” model is slow and inefficient. Much like email in the 90’s, it means you have to constantly check for events every few minutes or seconds. Can you imagine if Batman had to call Commissioner Gordon every 15 minutes to see if there were any emergencies? The Bat phone is a much better way — Commissioner Gordon can call Batman and notify him as soon as he has to go save Gotham City (important side-note: Batman is cooler than Superman).
“Hey commish — just calling again to see if anything for me to do”
Let’s say you are building a Serverless app to process new employees joining your company (hey, that sounds like it would make a great video). At some point I need to do work whenever an employee has been hired. During the process I may need to notify other components to do work as well (format and OCR these documents, add user to directory, etc.). Before Event Grid I would likely use a topic or queue and have my function polling it for work. With Event Grid, I can now publish my event, and my function will be notified to start work immediately.
More than just custom events, Event Grid comes loaded with events on systems you may already be using. Want to know whenever an IoT message has been emitted? All of those messages are already being pumped into Event Grid for you to subscribe. Want to know when a user has been added to one of your Virtual Machines? Simply subscribe and the event is ready to go. This is just the beginning. Over time many systems will light up in Event Grid, making it easy for you to start work no matter what type of event you care about.
In Azure Logic Apps (Serverless workflows), we have today over a hundred different triggers and events to listen to. So why am I excited about this news? Because the majority of our triggers today rely on polling. In fact a significant portion of our server usage as a service (those servers we don’t make you worry about) is triggers polling for events. Azure Event Grid-powered triggers allow not only our system to be more efficient, but the apps themselves to perform better as workflows are triggered the instant an event occurs.
Making your system or API webhook (or “push”) friendly can be tricky. You need to make sure you have at-least-once guaranteed delivery among a whole other host of challenges around scaling, state management, you name it. Azure Event Grid enables anyone to take advantage of webhook and “push” without having to do the heavy lifting yourself.
Just like today I rarely (if ever) click that “Send/Receive” button in Outlook or on my phone, in the next few years this idea of inefficient polling and latency will be a thing of the past. It couldn’t be easier to get started with custom topics as well — check out this quick-start and get started today.