SlideShare uma empresa Scribd logo
1 de 51
Baixar para ler offline
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Katy Shimizu
Software Engineer II, Azure Functions
@kashimizMSFT
katy.shimizu@microsoft.com
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Focus
Efficiency
Flexibility
What are the benefits?
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Azure Functions
Function Trigger
public static class SimpleExampleWithOutput
{
[FunctionName("CopyQueueMessage")]
public static void Run(
[QueueTrigger("myqueue-items-source")] string myQueueItem,
[Queue("myqueue-items-destination")] out string myQueueItemCopy,
ILogger log)
{
// Business logic goes here.
}
}
Output Binding
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0",
"configurationSource": "attributes",
"bindings": [
{
"type": "queueTrigger",
"queueName": "%input-queue-name%",
"name": "myQueueItem"
}
],
"disabled": false,
"scriptFile": "..binFunctionApp1.dll",
"entryPoint": "FunctionApp1.QueueTrigger.Run"
}
function.json
Sounds great, but I need..
automated testing
to run on-premises
custom dependencies
custom hardware
automated deploymentreal-time monitoring
sub-second latency
network isolation complex workflows
long-running processes
identity management
secure credentials storage
versioning strategy
state managementto run in a VNET
Agenda
• Hosting Options
• Premium
• KEDA
• Monitoring and Diagnostics
• Application Insights
• Security
• MSI and KeyVault Integration
• Deployment
• Azure DevOps
• Workflows and State
• Durable Functions and Entities
Platform
App delivery
OS
●●● ●●●
●●●
+
https://github.com/azure/azure-functions-host
(+other repos)
Azure Functions
host runtime
Azure Functions
Core Tools
Azure Functions
base Docker image
Azure Functions
.NET Docker image
Azure Functions
Node Docker image
●●●
• Serverless scale with bigger,
configurable instances
• Up to 4 cores 12Gb of memory
• Cold start controls
• Min plan size
• Pre-Warmed instances
• VNET connectivity
• Longer run duration
• ~25 minutes
• Predictable billing
• Max plan size
0
1
2
3
4
5
6
0 2 4 6 8 10 12 14
Load Consumption Instances
0
1
2
3
4
5
6
0 2 4 6 8 10 12 14
Load Available Instances
0
1
2
3
4
5
6
0 2 4 6 8 10 12 14
Load Premium Instances (1 Pre-Warmed)
0
1
2
3
4
5
6
0 2 4 6 8 10 12 14
Load Premium Instances (1 Pre-Warmed)
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
• Secure inbound HTTP access to your App
to one subnet in a VNET
• Allow secure outbound calls to resources
in a VNET
• Dependencies that you add can be
insecure
Internet
Functions
Runtime
HTTP Front-ends
Virtual Network
(VNET)
Virtual Network
(VNET)
• Leaving the multi-tenant world
• Your entire app is contained within a VNET
• Organizational controls over ingress / egress
• Limited scaling speed
Internet
Functions
Runtime
HTTP Front-ends
Orchestrates containerized workloads and
services.
Provides a clean interface for managing
distributed systems across many nodes,
including replication, scaling, and state
management.
App App
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Kubernetes cluster
Function pods
Horizontal
pod
autoscaler
Kubernetes
store
KEDA
Metrics
adapter
ScalerController
CLI
1->n or n->1 0->1 or 1->0
Any
events?
Register +
trigger and
scaling definition
External
trigger
source
When to
consider KEDA
Run functions on-premises / Intelligent edge
Run functions alongside existing Kubernetes
investments or requirements
Run functions on a different platform or
cloud
Run functions with full control and
management of scale and compute
Monitoring/Diagnostics
Azure Functions integrates with
Application Insights
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Spot the vulnerability!
module.exports = function (context, payload) {
if (payload.action != "opened") {
context.done();
return;
}
var comment = { "body": "Thank you for your contribution! We will get to it shortly." };
if (payload.pull_request) {
var pr = payload.pull_request;
context.log(pr.user.login, " submitted PR#", pr.number, ": ", pr.title);
SendGitHubRequest(pr.comments_url, comment, context); // posting a comment
}
context.done();
};
function SendGitHubRequest(url, requestBody, context) {
var request = require('request');
var githubCred = 'Basic ' + 'mattchenderson:8e254ed4';
request({
url: url,
method: 'POST',
headers: {
'User-Agent': 'mattchenderson',
'Authorization': githubCred
},
json: requestBody
}, function (error, response, body) {
if (error) {
context.log(error);
} else {
context.log(response.statusCode, body);
}
});
}
Secrets management
const msRestAzure = require('ms-rest-azure');
const KeyVault = require('azure-keyvault');
const vaultUri = process.env['GITHUB_SECRET_URI'];
// Value looks like: 'https://foo.vault.azure.net/secrets/gh'
//... Getting the event
let kvToken = msRestAzure.loginWithAppServiceMSI({
resource: 'https://vault.azure.net'
});
let keyVaultClient = new KeyVault.KeyVaultClient(kvToken);
keyVaultClient.getSecret(vaultUri).then(function (secret){
var githubHeader = 'Basic ' + secret;
//... Call GitHub
});
Managed identities for Azure Functions
 Keep credentials out of code
 Auto-managed identity in Azure AD
for Azure resource
 Use local token endpoint to get
access tokens from Azure AD
 Direct authentication with services,
or retrieve creds from Azure Key
Vault
Azure Functions
Azure Service
(e.g., ARM, Key Vault)
Your code
Local token
service
Credentials
1
2
3
Azure (inject and roll credentials)
Gets secrets out of App Settings
and into secrets management
Leverages the managed identity
of your function app
Versions required for initial
preview (goal of auto-rotation)
@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret/mysecretversion)
Foo: mysecret
Foo: mysecret
Foo: mysecret
Foo: reference
Foo: mysecret
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Inner and Outer Loop Development
• GA of Functions Build task
• Easily add Functions to a CI/CD pipeline
• New streamlined CLI command
• az functionapp devops-pipeline
create
• Automatically configures DevOps to build
with new commits to your version
control
• Configures Github or Azure Repos
automatically
aka.ms/functions-azure-devops
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
What’s still hard?
Durable Functions: function types
// calls functions in sequence
public static async Task<object> Run(DurableOrchestrationContext ctx)
{
try
{
var x = await ctx.CallFunctionAsync("F1");
var y = await ctx.CallFunctionAsync("F2", x);
return await ctx.CallFunctionAsync("F3", y);
}
catch (Exception)
{
// global error handling/compensation goes here
}
}
Orchestrator Function
Activity Functions
public static async Task<object> Run(DurableOrchestrationContext context)
{
try
{
var x = await context.CallActivityAsync<object>("F1");
var y = await context.CallActivityAsync<object>("F2", x);
var z = await context.CallActivityAsync<object>("F3", y);
return await context.CallActivityAsync<object>("F4", z);
}
catch (Exception)
{
// Error handling or compensation goes here.
}
}
// An HTTP-triggered function starts a new orchestrator function instance.
public static async Task<HttpResponseMessage> Run(
HttpRequestMessage req,
DurableOrchestrationClient starter,
string functionName,
ILogger log)
{
// The function name comes from the request URL.
// The function input comes from the request content.
dynamic eventData = await req.Content.ReadAsAsync<object>();
string instanceId = await starter.StartNewAsync(functionName, eventData);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}
public static async Task Run(DurableOrchestrationContext context)
{
int jobId = context.GetInput<int>();
int pollingInterval = GetPollingInterval();
DateTime expiryTime = GetExpiryTime();
while (context.CurrentUtcDateTime < expiryTime)
{
var jobStatus = await context.CallActivityAsync<string>("GetJobStatus", jobId);
if (jobStatus == "Completed")
{
// Perform an action when a condition is met.
await context.CallActivityAsync("SendAlert", machineId);
break;
}
// Orchestration sleeps until this time.
var nextCheck = context.CurrentUtcDateTime.AddSeconds(pollingInterval);
await context.CreateTimer(nextCheck, CancellationToken.None);
}
// Perform more work here, or let the orchestration end.
}
public static async Task Run(DurableOrchestrationContext context)
{
await context.CallActivityAsync("RequestApproval");
using (var timeoutCts = new CancellationTokenSource())
{
DateTime dueTime = context.CurrentUtcDateTime.AddHours(72);
Task durableTimeout = context.CreateTimer(dueTime, timeoutCts.Token);
Task<bool> approvalEvent = context.WaitForExternalEvent<bool>("ApprovalEvent");
if (approvalEvent == await Task.WhenAny(approvalEvent, durableTimeout))
{
timeoutCts.Cancel();
await context.CallActivityAsync("ProcessApproval", approvalEvent.Result);
}
else
{
await context.CallActivityAsync("Escalate");
}
}
}
“Hello MDC!”[“Hello MDC!”]
Orchestrator
Function
Activity
Function
Execution
History
var outputs = new List<string>();
outputs.Add(await context.CallActivityAsync<string>(“Hello”, “MDC”));
return outputs;
Orchestrator
Function
?
Activity
Function
“Hello MDC!”
Orchestrator Started
Execution Started
Task Scheduled, Hello, “MDC”
Orchestrator Completed
Task Completed, “Hello MDC!”
Orchestrator Started
Execution Completed, ["Hello MDC!"]
Orchestrator Completed
History Table
public static async Task Counter([EntityTrigger(EntityClassName = "Counter")] IDurableEntityContext ctx)
{
int currentValue = ctx.GetState<int>();
int operand = ctx.GetInput<int>();
switch (ctx.OperationName)
{
case "add":
currentValue += operand;
break;
case "subtract":
currentValue -= operand;
break;
case "reset":
await SendResetNotificationAsync();
currentValue = 0;
break;
}
ctx.SetState(currentValue);
}
• Entities process one operation at a time
• An entity will be automatically created if it
does not yet exist
• Operations can be non-deterministic
• Entity functions can perform external calls
(preferably with async APIs)
• Entities can invoke other entities, but only
one-way communication
Developing
entity
functions
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Event-driven programming model with Kubernetes - KEDA
Dependency injection support for .NET
Extension bundles
Durable Functions stateful patterns
Streamlined Azure DevOps experience
New Serverless Library experience
Premium Functions hosting option
Support for PowerShell Core 6
https://aka.ms/FunctionsBuild2019
Title Speakers Code Time
Serverless web apps with Blazor, Azure Functions, and
Azure Storage
Jeff Hollan THR2003 Monday, May 6
4:30 PM - 4:50 PM
Closing the key gaps of serverless with Azure Functions Alex Karcher
Jeff Hollan
BRK3042 Tuesday, May 7
10:00 AM - 11:00 AM
6 things you need to know about serverless Colby Tresness THR3009 Tuesday, May 7
2:00 PM - 2:20 PM
Bring serverless apps to life with Azure SignalR Service Anthony Chu THR3008 Tuesday, May 7
4:00 PM - 4:20 PM
Where should I host my code? Choosing between
Kubernetes, Containers, and Serverless
Jeff Hollan THR2005 Wednesday, May 8
10:00 AM - 10:20 AM
Event-driven design patterns to enhance existing
applications using Azure Functions
Daria Grigoriu
Eduardo Laureano
BRK3041 Wednesday, May 8
2:00 PM - 3:00 PM
The good, the bad and the ugly of Serverless Burke Holland
Cecil Phillip
CFS2025 Wednesday, May 8
3:30 PM - 4:30 PM
Mixing Stateful and Serverless – workflow, orchestration,
and actors
Matthew Henderson THR3011 Wednesday, May 8
4:00 PM - 4:20 PM
• GitHub: Azure/Azure-Functions
• Full Repository List
• MSDN Forums
• StackOverflow:
• azure-functions
• azure-durable-functions
• Twitter: @AzureFunctions
• UserVoice
• YouTube
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Available tools of Azure Functions

Mais conteúdo relacionado

Mais procurados

201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbrokerFIWARE
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksHector Ramos
 
«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​FDConf
 
Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5Billie Berzinskas
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaKasun Indrasiri
 
Inside Azure Diagnostics
Inside Azure DiagnosticsInside Azure Diagnostics
Inside Azure DiagnosticsMichael Collier
 
Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Morris Singer
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoDavid Lapsley
 
Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"IT Event
 
Kogito: cloud native business automation
Kogito: cloud native business automationKogito: cloud native business automation
Kogito: cloud native business automationMario Fusco
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaFabio Collini
 
Extending Kubernetes with Operators
Extending Kubernetes with OperatorsExtending Kubernetes with Operators
Extending Kubernetes with Operatorspeychevi
 
Spray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSpray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSandeep Purohit
 

Mais procurados (20)

201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & Tricks
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
 
«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​
 
Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Inside Azure Diagnostics
Inside Azure DiagnosticsInside Azure Diagnostics
Inside Azure Diagnostics
 
Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using Django
 
Ngrx meta reducers
Ngrx meta reducersNgrx meta reducers
Ngrx meta reducers
 
Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"
 
Typescript barcelona
Typescript barcelonaTypescript barcelona
Typescript barcelona
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Kogito: cloud native business automation
Kogito: cloud native business automationKogito: cloud native business automation
Kogito: cloud native business automation
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJava
 
Extending Kubernetes with Operators
Extending Kubernetes with OperatorsExtending Kubernetes with Operators
Extending Kubernetes with Operators
 
Async fun
Async funAsync fun
Async fun
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
 
Spray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSpray - Build RESTfull services in scala
Spray - Build RESTfull services in scala
 

Semelhante a [NDC 2019] Functions 2.0: Enterprise-Grade Serverless

El camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - IntroductionEl camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - IntroductionPlain Concepts
 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsBizTalk360
 
Working with data using Azure Functions.pdf
Working with data using Azure Functions.pdfWorking with data using Azure Functions.pdf
Working with data using Azure Functions.pdfStephanie Locke
 
Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)Paco de la Cruz
 
Building workflow solution with Microsoft Azure and Cloud | Integration Monday
Building workflow solution with Microsoft Azure and Cloud | Integration MondayBuilding workflow solution with Microsoft Azure and Cloud | Integration Monday
Building workflow solution with Microsoft Azure and Cloud | Integration MondayBizTalk360
 
Jenkins CI for MacDevOps
Jenkins CI for MacDevOpsJenkins CI for MacDevOps
Jenkins CI for MacDevOpsTimothy Sutton
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to CeleryIdan Gazit
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSTechWell
 
Workflow as code with Azure Durable Functions
Workflow as code with Azure Durable FunctionsWorkflow as code with Azure Durable Functions
Workflow as code with Azure Durable FunctionsMassimo Bonanni
 
Securing your Pulsar Cluster with Vault_Chris Kellogg
Securing your Pulsar Cluster with Vault_Chris KelloggSecuring your Pulsar Cluster with Vault_Chris Kellogg
Securing your Pulsar Cluster with Vault_Chris KelloggStreamNative
 
Develop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessDevelop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessLalit Kale
 
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Christian Schneider
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOSjimmyatmedium
 
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...CodeMill digital skills
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamImre Nagi
 

Semelhante a [NDC 2019] Functions 2.0: Enterprise-Grade Serverless (20)

El camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - IntroductionEl camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - Introduction
 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
 
Working with data using Azure Functions.pdf
Working with data using Azure Functions.pdfWorking with data using Azure Functions.pdf
Working with data using Azure Functions.pdf
 
Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)
 
Building workflow solution with Microsoft Azure and Cloud | Integration Monday
Building workflow solution with Microsoft Azure and Cloud | Integration MondayBuilding workflow solution with Microsoft Azure and Cloud | Integration Monday
Building workflow solution with Microsoft Azure and Cloud | Integration Monday
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Jenkins CI for MacDevOps
Jenkins CI for MacDevOpsJenkins CI for MacDevOps
Jenkins CI for MacDevOps
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
 
Workflow as code with Azure Durable Functions
Workflow as code with Azure Durable FunctionsWorkflow as code with Azure Durable Functions
Workflow as code with Azure Durable Functions
 
Securing your Pulsar Cluster with Vault_Chris Kellogg
Securing your Pulsar Cluster with Vault_Chris KelloggSecuring your Pulsar Cluster with Vault_Chris Kellogg
Securing your Pulsar Cluster with Vault_Chris Kellogg
 
Develop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessDevelop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverless
 
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
Big Data Tools in AWS
Big Data Tools in AWSBig Data Tools in AWS
Big Data Tools in AWS
 
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 

Último

Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLAlluxio, Inc.
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfBrain Inventory
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.Sharon Liu
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfTobias Schneck
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmonyelliciumsolutionspun
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...OnePlan Solutions
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptkinjal48
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native BuildpacksVish Abrams
 
Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntelliSource Technologies
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyRaymond Okyere-Forson
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadIvo Andreev
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 

Último (20)

Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdf
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.ppt
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native Buildpacks
 
Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptx
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human Beauty
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and Bad
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 

[NDC 2019] Functions 2.0: Enterprise-Grade Serverless

  • 2. Katy Shimizu Software Engineer II, Azure Functions @kashimizMSFT katy.shimizu@microsoft.com
  • 8. Function Trigger public static class SimpleExampleWithOutput { [FunctionName("CopyQueueMessage")] public static void Run( [QueueTrigger("myqueue-items-source")] string myQueueItem, [Queue("myqueue-items-destination")] out string myQueueItemCopy, ILogger log) { // Business logic goes here. } } Output Binding { "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0", "configurationSource": "attributes", "bindings": [ { "type": "queueTrigger", "queueName": "%input-queue-name%", "name": "myQueueItem" } ], "disabled": false, "scriptFile": "..binFunctionApp1.dll", "entryPoint": "FunctionApp1.QueueTrigger.Run" } function.json
  • 9. Sounds great, but I need.. automated testing to run on-premises custom dependencies custom hardware automated deploymentreal-time monitoring sub-second latency network isolation complex workflows long-running processes identity management secure credentials storage versioning strategy state managementto run in a VNET
  • 10. Agenda • Hosting Options • Premium • KEDA • Monitoring and Diagnostics • Application Insights • Security • MSI and KeyVault Integration • Deployment • Azure DevOps • Workflows and State • Durable Functions and Entities
  • 11. Platform App delivery OS ●●● ●●● ●●● + https://github.com/azure/azure-functions-host (+other repos) Azure Functions host runtime Azure Functions Core Tools Azure Functions base Docker image Azure Functions .NET Docker image Azure Functions Node Docker image ●●●
  • 12. • Serverless scale with bigger, configurable instances • Up to 4 cores 12Gb of memory • Cold start controls • Min plan size • Pre-Warmed instances • VNET connectivity • Longer run duration • ~25 minutes • Predictable billing • Max plan size
  • 13. 0 1 2 3 4 5 6 0 2 4 6 8 10 12 14 Load Consumption Instances
  • 14. 0 1 2 3 4 5 6 0 2 4 6 8 10 12 14 Load Available Instances
  • 15. 0 1 2 3 4 5 6 0 2 4 6 8 10 12 14 Load Premium Instances (1 Pre-Warmed)
  • 16. 0 1 2 3 4 5 6 0 2 4 6 8 10 12 14 Load Premium Instances (1 Pre-Warmed)
  • 19. • Secure inbound HTTP access to your App to one subnet in a VNET • Allow secure outbound calls to resources in a VNET • Dependencies that you add can be insecure Internet Functions Runtime HTTP Front-ends Virtual Network (VNET)
  • 20. Virtual Network (VNET) • Leaving the multi-tenant world • Your entire app is contained within a VNET • Organizational controls over ingress / egress • Limited scaling speed Internet Functions Runtime HTTP Front-ends
  • 21. Orchestrates containerized workloads and services. Provides a clean interface for managing distributed systems across many nodes, including replication, scaling, and state management. App App
  • 23. Kubernetes cluster Function pods Horizontal pod autoscaler Kubernetes store KEDA Metrics adapter ScalerController CLI 1->n or n->1 0->1 or 1->0 Any events? Register + trigger and scaling definition External trigger source
  • 24. When to consider KEDA Run functions on-premises / Intelligent edge Run functions alongside existing Kubernetes investments or requirements Run functions on a different platform or cloud Run functions with full control and management of scale and compute
  • 27. Spot the vulnerability! module.exports = function (context, payload) { if (payload.action != "opened") { context.done(); return; } var comment = { "body": "Thank you for your contribution! We will get to it shortly." }; if (payload.pull_request) { var pr = payload.pull_request; context.log(pr.user.login, " submitted PR#", pr.number, ": ", pr.title); SendGitHubRequest(pr.comments_url, comment, context); // posting a comment } context.done(); }; function SendGitHubRequest(url, requestBody, context) { var request = require('request'); var githubCred = 'Basic ' + 'mattchenderson:8e254ed4'; request({ url: url, method: 'POST', headers: { 'User-Agent': 'mattchenderson', 'Authorization': githubCred }, json: requestBody }, function (error, response, body) { if (error) { context.log(error); } else { context.log(response.statusCode, body); } }); }
  • 28. Secrets management const msRestAzure = require('ms-rest-azure'); const KeyVault = require('azure-keyvault'); const vaultUri = process.env['GITHUB_SECRET_URI']; // Value looks like: 'https://foo.vault.azure.net/secrets/gh' //... Getting the event let kvToken = msRestAzure.loginWithAppServiceMSI({ resource: 'https://vault.azure.net' }); let keyVaultClient = new KeyVault.KeyVaultClient(kvToken); keyVaultClient.getSecret(vaultUri).then(function (secret){ var githubHeader = 'Basic ' + secret; //... Call GitHub });
  • 29. Managed identities for Azure Functions  Keep credentials out of code  Auto-managed identity in Azure AD for Azure resource  Use local token endpoint to get access tokens from Azure AD  Direct authentication with services, or retrieve creds from Azure Key Vault Azure Functions Azure Service (e.g., ARM, Key Vault) Your code Local token service Credentials 1 2 3 Azure (inject and roll credentials)
  • 30. Gets secrets out of App Settings and into secrets management Leverages the managed identity of your function app Versions required for initial preview (goal of auto-rotation) @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret/mysecretversion) Foo: mysecret Foo: mysecret Foo: mysecret Foo: reference Foo: mysecret
  • 32. Inner and Outer Loop Development
  • 33. • GA of Functions Build task • Easily add Functions to a CI/CD pipeline • New streamlined CLI command • az functionapp devops-pipeline create • Automatically configures DevOps to build with new commits to your version control • Configures Github or Azure Repos automatically aka.ms/functions-azure-devops
  • 37. // calls functions in sequence public static async Task<object> Run(DurableOrchestrationContext ctx) { try { var x = await ctx.CallFunctionAsync("F1"); var y = await ctx.CallFunctionAsync("F2", x); return await ctx.CallFunctionAsync("F3", y); } catch (Exception) { // global error handling/compensation goes here } } Orchestrator Function Activity Functions
  • 38. public static async Task<object> Run(DurableOrchestrationContext context) { try { var x = await context.CallActivityAsync<object>("F1"); var y = await context.CallActivityAsync<object>("F2", x); var z = await context.CallActivityAsync<object>("F3", y); return await context.CallActivityAsync<object>("F4", z); } catch (Exception) { // Error handling or compensation goes here. } }
  • 39. // An HTTP-triggered function starts a new orchestrator function instance. public static async Task<HttpResponseMessage> Run( HttpRequestMessage req, DurableOrchestrationClient starter, string functionName, ILogger log) { // The function name comes from the request URL. // The function input comes from the request content. dynamic eventData = await req.Content.ReadAsAsync<object>(); string instanceId = await starter.StartNewAsync(functionName, eventData); log.LogInformation($"Started orchestration with ID = '{instanceId}'."); return starter.CreateCheckStatusResponse(req, instanceId); }
  • 40. public static async Task Run(DurableOrchestrationContext context) { int jobId = context.GetInput<int>(); int pollingInterval = GetPollingInterval(); DateTime expiryTime = GetExpiryTime(); while (context.CurrentUtcDateTime < expiryTime) { var jobStatus = await context.CallActivityAsync<string>("GetJobStatus", jobId); if (jobStatus == "Completed") { // Perform an action when a condition is met. await context.CallActivityAsync("SendAlert", machineId); break; } // Orchestration sleeps until this time. var nextCheck = context.CurrentUtcDateTime.AddSeconds(pollingInterval); await context.CreateTimer(nextCheck, CancellationToken.None); } // Perform more work here, or let the orchestration end. }
  • 41. public static async Task Run(DurableOrchestrationContext context) { await context.CallActivityAsync("RequestApproval"); using (var timeoutCts = new CancellationTokenSource()) { DateTime dueTime = context.CurrentUtcDateTime.AddHours(72); Task durableTimeout = context.CreateTimer(dueTime, timeoutCts.Token); Task<bool> approvalEvent = context.WaitForExternalEvent<bool>("ApprovalEvent"); if (approvalEvent == await Task.WhenAny(approvalEvent, durableTimeout)) { timeoutCts.Cancel(); await context.CallActivityAsync("ProcessApproval", approvalEvent.Result); } else { await context.CallActivityAsync("Escalate"); } } }
  • 42. “Hello MDC!”[“Hello MDC!”] Orchestrator Function Activity Function Execution History var outputs = new List<string>(); outputs.Add(await context.CallActivityAsync<string>(“Hello”, “MDC”)); return outputs; Orchestrator Function ? Activity Function “Hello MDC!” Orchestrator Started Execution Started Task Scheduled, Hello, “MDC” Orchestrator Completed Task Completed, “Hello MDC!” Orchestrator Started Execution Completed, ["Hello MDC!"] Orchestrator Completed History Table
  • 43. public static async Task Counter([EntityTrigger(EntityClassName = "Counter")] IDurableEntityContext ctx) { int currentValue = ctx.GetState<int>(); int operand = ctx.GetInput<int>(); switch (ctx.OperationName) { case "add": currentValue += operand; break; case "subtract": currentValue -= operand; break; case "reset": await SendResetNotificationAsync(); currentValue = 0; break; } ctx.SetState(currentValue); }
  • 44. • Entities process one operation at a time • An entity will be automatically created if it does not yet exist • Operations can be non-deterministic • Entity functions can perform external calls (preferably with async APIs) • Entities can invoke other entities, but only one-way communication Developing entity functions
  • 47. Event-driven programming model with Kubernetes - KEDA Dependency injection support for .NET Extension bundles Durable Functions stateful patterns Streamlined Azure DevOps experience New Serverless Library experience Premium Functions hosting option Support for PowerShell Core 6 https://aka.ms/FunctionsBuild2019
  • 48. Title Speakers Code Time Serverless web apps with Blazor, Azure Functions, and Azure Storage Jeff Hollan THR2003 Monday, May 6 4:30 PM - 4:50 PM Closing the key gaps of serverless with Azure Functions Alex Karcher Jeff Hollan BRK3042 Tuesday, May 7 10:00 AM - 11:00 AM 6 things you need to know about serverless Colby Tresness THR3009 Tuesday, May 7 2:00 PM - 2:20 PM Bring serverless apps to life with Azure SignalR Service Anthony Chu THR3008 Tuesday, May 7 4:00 PM - 4:20 PM Where should I host my code? Choosing between Kubernetes, Containers, and Serverless Jeff Hollan THR2005 Wednesday, May 8 10:00 AM - 10:20 AM Event-driven design patterns to enhance existing applications using Azure Functions Daria Grigoriu Eduardo Laureano BRK3041 Wednesday, May 8 2:00 PM - 3:00 PM The good, the bad and the ugly of Serverless Burke Holland Cecil Phillip CFS2025 Wednesday, May 8 3:30 PM - 4:30 PM Mixing Stateful and Serverless – workflow, orchestration, and actors Matthew Henderson THR3011 Wednesday, May 8 4:00 PM - 4:20 PM
  • 49. • GitHub: Azure/Azure-Functions • Full Repository List • MSDN Forums • StackOverflow: • azure-functions • azure-durable-functions • Twitter: @AzureFunctions • UserVoice • YouTube
  • 51. Available tools of Azure Functions

Notas do Editor

  1. Abstraction of servers, infrastructure, OS config “Functions as a Service” OS/framework patching No need to manage infrastructure Event-driven scale Triggered by events within Azure or third-party services React in near real time to events and triggers Scales within seconds quickly, limitlessly* No scale configuration required Sub-second billing Pay only for the time your code is running
  2. Bindings Microsoft.NET.Sdk.Functions (.NET Standard 2.0) HTTP Timer Microsoft.Azure.WebJobs.Extensions.Storage 3.0.0 Microsoft.Azure.WebJobs.Extensions.ServiceBus 3.0.0 Microsoft.Azure.Webjobs.Extensions.EventHubs 3.0.0 Microsoft.Azure.WebJobs.Extensions.CosmosDB 3.0.0 Microsoft.Azure.Webjobs.Extensions.EventGrid 2.0.0 Microsoft.Azure.WebJobs.Extensions.DurableTask 1.4.0 Microsoft.Azure.Webjobs.Extensions.MicrosoftGraph 1.0.0-beta Scenarios Web/Mobile app workloads IoT-connected backends Real-time processing Automation of infrastructure
  3. The time it takes to ready an instance when no instance yet exists Varies greatly on a number of factors like language and # of files Today for C# in v1 is generally around 3-4 seconds today, 1-2 seconds in on-deck release Few angles of attack Pre-warmed “workers” Zipped artifacts without extract (Zip Deploy) Keep alive (keep warm longer) Users can help mitigate by: Using Zip Deploy if possible (paired with something like funcpack for Node) Use C# Class Libraries over .csx for large functions If push comes to shove, a “pinger” can keep warm
  4. Function with blob full of files I want to encrypt haven’t called it in last twenty minutes Call premium and consumption
  5. -- K8 is reactive: container CPU/memory -- Fx is event-driven: ex. queue depth, Kafka stream length -- partnered w/Red Hat -- scale from 0-1000s of instances -- containers consume events directly from source; no decoupling w/HTTP -- routing through HTTP == data and context loss -- extensible -- Azure Functions are containerizable -- deploy in-cloud or on-prem -- Fx run integrated w/OpenShift [[WHAT IS THIS]] -- adds event sources to K8s -- we see most of our executions come from non-HTTP sources (HTTP only 30%) -- Kafka, Azure Queues, Azure Service Bus, RabbitMQ, HTTP, and Azure Event Grid / Cloud Events. More triggers will continue to be added in the future including Azure Event Hubs, Storage, Cosmos DB, and Durable Functions. -- runs alongside Virtual Kubelet and AKS Virtual Nodes [[ WHAT ARE THESE ]] -- open source -- webinar! May 28: aka.ms/keda-webinar -- when to consider KEDA
  6. https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#v2 https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli https://stackoverflow.com/questions/46877667/how-to-push-a-new-initial-project-to-github-using-vs-code
  7. Imagine a scenario where I have to take the output of a Function and use it as the input to call another Function. I’ll have to coordinate the chaining manually. If I have to have a function that takes some sort of event and then parallelizes it into multiple Functions, I can still do that but how will I know when all Functions have finished executing so I can aggregate the results and move on. What if I had to listen on multiple events and aggregate their outcome to determine which specific job or function to run in my application. What if I wanted to do some kind of extended monitoring on an endpoint? For example, if I were to monitor the temperature of a remote machine and take action x if the temperature were lower than a certain threshold, else do y or run job y. What if I have an API or endpoint that was running for a long time? I know Functions are short-lived but sometimes you guys put some serious load on them. Could there be a mechanism to provide status of the execution back to the client so they’re not left hanging? And lastly, what if I wanted to get some sort of human interaction in there? For example, if I am to do some sort of 2FA in the middle of my function execution but also don’t want to wait forever because sometimes people take forever to reply especially when the texts are automated. Today, I’m going to be talking about some of these problems – how you can approach them in regular FaaS? And how they can be simplified with the technology of Durable Functions.
  8. In the function chaining pattern, a sequence of functions executes in a specific order. In this pattern, the output of one function is applied to the input of another function.
  9. The async HTTP APIs pattern addresses the problem of coordinating the state of long-running operations with external clients. A common way to implement this pattern is by having an HTTP call trigger the long-running action. Then, redirect the client to a status endpoint that the client polls to learn when the operation is finished.
  10. The monitor pattern refers to a flexible, recurring process in a workflow. An example is polling until specific conditions are met. You can use a regular timer trigger to address a basic scenario, such as a periodic cleanup job, but its interval is static and managing instance lifetimes becomes complex. You can use Durable Functions to create flexible recurrence intervals, manage task lifetimes, and create multiple monitor processes from a single orchestration.
  11. Many automated processes involve some kind of human interaction. Involving humans in an automated process is tricky because people aren't as highly available and as responsive as cloud services. An automated process might allow for this by using timeouts and compensation logic.
  12. Grasping how orchestrators use execution history to replay and rebuild their local state is key to understanding how Durable Functions works, so let’s walk through the execution of a simple orchestrator function. The light blue box at the top of the slide is the orchestrator’s code. “SayHello” our activity function, which returns “Hello” and whatever input you give it. Our execution history is currently empty. As we start to record events, they’ll show up here. (Indicate area.) 1. A request is made to the orchestrator function. 2. The orchestrator starts and begins executing until it’s asked to await some async work. In this case, we want to call an activity function. 3. The orchestrator checks the execution history for a record of the activity function. 4. There’s no record of the activity function being called or completed, so the orchestrator schedules that work. 5. While the orchestrator waits on work to complete, it shuts down. 5. The scheduled activity function runs. 6. A record of this is added to the execution history. In this case we produced output, so that’s stored. 7. Now the orchestrator has more work to do. It restarts and executes its code **from the beginning** to build up its local state. 8. As before, the orchestrator executes until it reaches an await. 9. The orchestrator checks the execution history. This time there’s a record of the async work being done. 10. The activity function’s stored output is passed back to the orchestrator. In this case, the value is added to a list of strings. 11. The orchestrator continues executing. In a more complex orchestrator with multiple await calls, the checkpoint, schedule and replay steps would repeat for each one. This orchestrator runs to completion and returns its output. 12. And we’re done! - How does the framework know to wake up
  13. The sixth pattern is about aggregating event data over a period of time into a single, addressable entity. In this pattern, the data being aggregated may come from multiple sources, may be delivered in batches, or may be scattered over long-periods of time. The aggregator might need to take action on event data as it arrives, and external clients may need to query the aggregated data.