Speaker: Andrew Westgarth
Functions is a service event based experience to accelerate you development. Before cloud it was all up to you, your hardware, your VMs, etc. You have to pre-plan, procurement would take years. When you maxed out the capacity, what do you do? What happens when the server goes down? How often should I back up? Lots of decisions for you.
Then came IaaS but a big company is managing it for you. Questions like how many servers you need is inconsequential. A number of decisions went away.
Is it PaaS time? You have more questions. Which packages do I need? What is this going to cost me? Who is monitoring my app?
The new kid on the block is Serverless which gets rid of more questions because Azure takes care of it.
Serverless is an abstraction of servers driven by events. There are still servers below it but you don’t have to manage them. You just deploy your code and it runs, no administration. Serverless scales incredibly quick. Fast to get started with reduced DevOps, ease of scale with focus on business logic.
Azure Functions is all about processing events with Serverless code. You as devs can compose your app quickly and easily. Develop your functions in C#, Python in preview, Node.js, F#, PHP, etc. No barrier in what language you work in. You can schedule event-driven tasks. Functions are scaled based on demand. Easily integrate in Logic Apps. Compiles at save time.
Hello World HTTP Trigger
- In Market under Compute, Functions app
- IDE environment:
- Functions on the left-hand side, can have multiple functions
- Expose the Functions URL and the function is available immediately
- Code window
- Project view on the right-hand side
- Test runner
- Write code, test, save and run.
- Integration, Management and Monitor capabilities.
Azure Functions architecture
Build on top of App Service and WebJobs SDK.
Variety of templates in the UI to get started quickly. Sample apps, experimental templates.
- Timer trigger in C#
- Function already started
- Script change takes effect immediately
- Save and run
Serverless compute takes away the compute. Bindings abstract away the service integration.
Function Programming Model
Function is a single unit of work that is run again and again. Can be trigger by event. Executed based on the trigger that Is assigned, timer, HTTP manually. Functions have input and outputs. There are bindings like authLevel, name, type, direction. At the guts of it is the code that devs should be focusing on.
Chaining functions with queue
With publisher-consumer pattern.
- New function Publisher in Queue with name
- Trigger HTTP
- Output binding is Azure Storage Queue
- Write code.
- Create consumer, new function Consumer of type QueueTrigger
- Function started, message on the queue, go to consumer and run
This is an example of how to daisy chain, with HTTP or chaining functions to other events. Pubsub model with only 2 script files. Able to be productive really fast inside the tooling.
What happens when the service becomes powerful and needs to run a lot to workload? How do we deal with sudden bursts of requests? App Service is deployed in every data center acros the globe and offers high scale, with dedicated App Service plan where you pay for VMs but you are responsible on the scale and the new model that comes with Serverless where you pay on consumption basis, you pay on number of executions and the platform takes care of the scaling for you.
If you have an Azure subscription you get 1 million execution and 400 00 GB-s per month included for free.
Serverless patterns with Azure Functions
- Timer based processing
- Azure service event processing
- Serverless web app architecture
- Real-time stream processing: IoT, smart watches – get the data into Stream Analytics, transform, store.
- Real-time bot messaging: use Cortana Analytics to answer questions sent to chatbots
- Serverless mobile backends
- SaaS event processing
Integrating with third-parties
- Manual trigger
- Input is external file, reading a file store from a third party
- Take the document and put it in a Blob Storage
- External File binding (still in Preview), select and configure external connection.
- Output to Blob Storage.
Coming soon: Azure Functions running on premise in a private cloud.
Developer experience: write Azure Functions in VS2015 (in Preview), soon also in VS2017.
You don’t have to hand over a credit card.