Coming up
we take a look at how Azure serverless offerings
allow you to build and deploy elastic scale cost-efficient apps on Azure.
We'll show you how adopting a serverless compute approach
removes the need to worry about hardware resources
and the operational complexity of running applications.
The event-driven model for triggering compute power
it allows you to just pay for what you use.
And we'll walk through a serverless app for social analytics
Microsoft Mechanics
I'm joined by Jeff Hollan from the Azure Serverless Compute team, welcome.
Thrilled to be here!
So severless computing seems to have picked up a lot of momentum over the last year.
but what is it and why is it come about?
Yeah so it's a response to a number of things.
but mainly it's around removing traditional barriers
and building and deploying software to solve business needs.
Traditional apps are designed to conform to the infrastructure they run on.
Serverless apps offer an app first model by abstracting away the infrastructure
to relieve the developer from the operational complexity of running applications.
The infrastructure only fires up when it needs to.
It's serverless because you no longer have to worry about servers, virtual machines,
patching and scaling.
All those pieces that traditionally you have to manage
and take time away from creating solutions.
With serverless you simply define your code
or the steps that need to happen.
Publish it to Azure
and the rest is automatically taken care of for you.
This means you can build and deploy cloud scale applications in a fraction of the time.
Now what you just described sounds a lot like PaaS.
But how does this differ from platform as a Service?
Yeah so with PaaS you still have to choose your operating system and the VM size
which means you need to be able to forecast your demand and then pay for that capacity
even if it's not fully utilized.
How does this actually work in Azure?
With Serverless, Azure has compute resources ready to be allocated to you.
Their usage is triggered by an event.
You give us your code and when an event happens.
This could be an Azure alert or when a message is received.
Whatever you specify, we spin up the necessary compute resources
and its activity based billing.
So you only pay for when you're using the resources.
So can you give us an example and explain the serverless tech architecture behind this?
Sure, if I have a website and people want to upload pictures
let's say I need to resize those pictures.
So whenever someone uploads a picture I want to automatically resize it.
Well the upload is the event and that's where Azure functions come in.
It contains and runs your code to resize the picture.
and it has a series of bindings that attach to the event you want to listen to
So in this case it listens for an upload and automatically resizes the image.
So I'm a developer and I've got my chunk of code and I give it to Azure functions and it executes?
Yeah that's exactly right.
But what if I need my code to perform multiple tasks?
So if we stick with our photo example.
Resize, compress, create a thumbnail and then upload it to a store.
Yeah so each one of those individual tasks would be an azure function.
And to orchestrate these different tasks I would use Azure logic apps to build a workflow.
So in our example, the different tasks from
resizing, compressing, creating a thumbnail and displaying it in the store.
Those would be executed on an uploaded picture.
And once all these tests are done I could make the next step
to store the picture in OneDrive or my chosen cloud storage.
And what's great is that most of the time I don't even need to write the code.
for the orchestration or to integrate with apps like OneDrive
because Azure logic apps has pre-built connectors.
So developers can just focus on their blocks of code
and they can utilize these connectors to integrate with their existing systems?
Exactly, so I'm showing here
there's over a 150 connectors provided by logic apps today
and this allows me to easily bind my serverless app
to listen to events from sources like dynamics or Salesforce.
And I can also very easily create or push data into any of these sources.
Now a lot of these connectors and what they connect to will be familiar to IT.
So it's important that an IT and developers work closely
to integrate these in a way that is right for the business.
Right, in fact a lot of the value that IT finds in systems like Logic apps
is that it allows them to very easily integrate
those apps that their devs are building with the systems that they manage.
So it sounds powerful, but can we see it in action?
Sure so I'll walk you through now the tools needed to build a serverless app.
And actually in just a few minutes we'll actually have something pretty powerful up and running.
So in our case we're going to listen to a data source,
which is Twitter.
We're going to be listening for different tweets.
So maybe there's a conference or a launch that you are interested in understanding more about.
So as tweets come in
we'll analyze them and publish them into a Power BI dashboard all in real time.
So I'm here in the Azure portal
and this is the start of our app
and we're going to use that serverless workflow
logic apps to start building our serverless app.
You'll notice here I've already added the event which is when a tweet is posted.
And in this case I'm actually listening to tweets about Microsoft.
Now I can start to add in actions and resources to spin up when this event happens.
So I'll go ahead here and add a step.
And you'll notice those connectors we referenced earlier.
And here I'm actually going to choose the text analytics connector
which uses machine learning as part of the cognitive services
to actually do advanced things like detect the sentiment or pull out key phrases.
So within just a few clicks
I could pass in the tweet text.
And now just that easily I've added machine learning into my service workflow.
So at this point I have the tweet
and now I've been able to automatically detect if it's positive or negative.
So this is a great place for us to now add in an Azure function
because maybe I want to set a category like red, yellow, or green based on the sentiment.
So I can go ahead here and add another step.
And here I can choose any of my Azure functions to execute on demand.
So I'm going to go ahead here and choose an Azure function which I wrote ahead of time
That will categorize the tweet based on the sentiment score.
So the sentiment service will give it a number between 0 & 1.
0 being very negative and 1 being very positive.
So I'll actually show you what this Azure function looks like.
So this is an Azure function in the portal.
And you can see it's very simple I've just simply had to define my trigger event here
which will be triggered from a logic app.
And then I just wrote the simple code.
So if the scores below .3, it's red.
If it's below .6, it's yellow.
And everything else is green.
And just that easily I've defined the code and now it will run whenever it needs to.
So what's happening here behind the scenes from a resource allocation and utilization perspective?
Yeah so resources will be deployed on demand as needed.
So I'll actually switch here.
There's a function that's been running all day today.
And I'll show you how it's running and it's running pretty heavily.
So it's automatically spanned a number of different servers
to handle that execution.
What's great is that I only define the code
and these servers have been provisioned and scaled out to meet demands automatically
and I'm only paying for what I use.
And it'll auto scale as necessary and you don't to worry about anything infrastructure related?
Exactly.
And this is what we saw before c-sharp code, but are there other languages supported?
Yes so if I create a new function
I can actually choose from a number of different supported languages
like C sharp, PowerShell, and Java Script
This enables me as a developer to use the language that's best suited for the job.
And I can build, deploy, and debug these serverless apps all within Visual Studio.
But now can you go ahead and visualize the data?
Yeah exactly, so here I'm going to come back to our serverless app.
I do want to visualize the the data that I've generated
So I'm going to add in one more action.
And in this case I'm going to use our Power BI connector
to publish this data to a dashboard in real-time.
Now while I fill out this step for the Power BI connector,
I do want to call out here that I am connected to my Power BI account.
And we take security very seriously, so we use Azure key vault behind the scenes
to securely encrypt and store the credentials needed
to authenticate with this service.
So whenever OAuth is provided
we always use OAuth.
And if OAuth is not available, we'll use whatever means is most secure.
Because we're connecting to data that is critical to running your business,
it's great to see that secure connectivity is
just built into the serverless platform.
Yeah that's right, and as you're connecting to multiple disparate data sources
we want to make that as secure as possible.
So what happens next?
Yeah so I'll go ahead here and finish pushing this data to the Power BI connector.
Things like that category that we generated from the Azure function.
The location of where the person is tweeting from.
And when this tweet was created at.
And what's powerful here is now I've created this
and I can simply click Save to publish it
and it will start triggering on those events from Twitter.
So go ahead now and switch to this Power BI dashboard.
And in just a few seconds you'll start to watch this dashboard light up
as people are tweeting about Microsoft.
Those tweets are being processed automatically by our serverless app
and scaling up the resources needed
to process those requests.
Now if this was during a high time of traffic like Microsoft build,
I have confidence in knowing that my app could automatically scale to meet those demands.
Can we see into the app?
Yeah so I'll actually show you I've taken an app very similar to this
It starts the same way but I've added a few more steps.
So after I published to Power BI,
I've actually added in some logic here.
So that if somebody tweets a very negative sentiment tweet
I can automatically do something like alert a team using Microsoft teams
or create a case within Dynamics 365
So that my company can be monitoring the customer sentiment
and following up with customers on Twitter.
So now the app is deployed how do we ensure that it's
tested and ensure it's running efficiently on an ongoing basis?
Yeah so this isn't like traditional infrastructure
where you can look at processor utilization or other metric
So it all comes to life with a trigger
and as you're building the app, you're running tests to simulate the event,
triggers to make sure the app that work in the way that you want.
And with that serverless apps do come with a lot of tracing out of the box.
So I can easily see here from right within Azure
all of these apps as they are running and understand the data that's being processed.
And I get integration with powerful tools like Azure monitor
so I can view metrics or diagnostics,
set things like alerts for if something goes wrong.
You saw me show this earlier,
but I can use tools like Azure app insights
to understand the health of my app.
And even integrate with solutions like OMS
so that I can do query analytics and understand exactly how my systems are performing
against my solution.
So with Azure serverless offerings
you're getting a fully managed service that scales on demand
and run your apps in a fraction of the time.
But, how do people get started with Azure serverless?
Yeah so we have a few quick starts on the Azure functions and Azure logic apps documentation pages.
And what's great about serverless
is you can spend just an hour or two and have some really powerful apps ready to go.
So I'd encourage you to check it and out reach out to us on Twitter if you have any questions.
And see what serverless computing and Azure can do for you.
Awesome stuff, thanks for joining us Jeff.
And don't forget to keep watching Microsoft Mechanics for the latest in tech updates.
See you next time
Microsoft Mechanics
www.microsoft.com/mechanics
Không có nhận xét nào:
Đăng nhận xét