From Zero to Serverless DogFoodCon October 4, 2018 Who is Chad - - PowerPoint PPT Presentation

from zero to serverless
SMART_READER_LITE
LIVE PREVIEW

From Zero to Serverless DogFoodCon October 4, 2018 Who is Chad - - PowerPoint PPT Presentation

Chad Green From Zero to Serverless DogFoodCon October 4, 2018 Who is Chad Green Data & Solutions Architect at ProgressiveHealth Community Involvement Code PaLOUsa Conference Chair Louisville .NET Meetup Organizer


slide-1
SLIDE 1

From Zero to Serverless

DogFoodCon October 4, 2018

Chad Green

slide-2
SLIDE 2

Who is Chad Green

  • Data & Solutions Architect at ProgressiveHealth
  • Community Involvement
  • Code PaLOUsa Conference Chair
  • Louisville .NET Meetup Organizer
  • Louisville Tech Leaders Meetup Co-Organizer
  • Louisville Tech Ladies Committee Member
  • Contact Information

chadgreen@chadgreen.com chadgreen.com ChadGreen ChadwickEGreen

slide-3
SLIDE 3

What is Serverless Computing

From Zero to Serverless

slide-4
SLIDE 4

From Zero to Serverless

The evolution of application platforms

4

On-Premises

Which packages should be on my server? How do I deploy new code to my servers? How can I increase server utilization? How often should I patch my servers? What size of servers should I buy? Who has physical access to my servers? It takes how long to provision a new server?

slide-5
SLIDE 5

From Zero to Serverless

The evolution of application platforms

5

IaaS

What is the right size of servers for my business needs? How can I increase server utilization? How many servers do I need? How can I scale my application? How do I deploy new code to my server? Which Operating System should I use? Who monitors my application? How often should I patch my servers? How often should I backup my server? Which packages should be on my server?

slide-6
SLIDE 6

From Zero to Serverless

The evolution of application platforms

6

PaaS

What is the right size of servers for my business needs? How can I increase server utilization? How many servers do I need? How can I scale my application?

slide-7
SLIDE 7

From Zero to Serverless

The evolution of application platforms

7

Serverless The platform for next generation applications

slide-8
SLIDE 8

From Zero to Serverless

What is Serverless?

8

  • Applications that significantly or fully

depend on services (in the cloud) to manage server-side logic and state

Area #1 Area #2

  • Application run in stateless compute

containers that are event-triggered, ephemeral, and fully managed by a 3rd party

Backend as a Service (BaaS) Functions as a Service (FaaS)

slide-9
SLIDE 9

From Zero to Serverless

What is Serverless?

9

  • Applications that significantly or fully

depend on services (in the cloud) to manage server-side logic and state

Area #1 Area #2

  • Application run in stateless compute

containers that are event-triggered, ephemeral, and fully managed by a 3rd party

Backend as a Service (BaaS) Functions as a Service (FaaS)

slide-10
SLIDE 10

From Zero to Serverless

What is Serverless?

10

Abstraction of Servers Event-Driven/Instant Scale Micro-Billing

slide-11
SLIDE 11

From Zero to Serverless

Benefits of Serverless

11

Reduced DevOps Faster Time to Market Manage apps not servers

slide-12
SLIDE 12

From Zero to Serverless

Serverless Scale

12

Monolith

Microservice Microservice Microservice Microservice Function Function Function Function Function Function Function Function Function Function Function

Nano Services

slide-13
SLIDE 13

From Zero to Serverless

Challenges of Serverless Architecture

13

Complexity Organizational Support No Runtime Optimization

slide-14
SLIDE 14

Serverless Options

From Zero to Serverless

slide-15
SLIDE 15

From Zero to Serverless

Serverless Options

15

  • Zimki
  • Google Cloud Functions
  • Amazon Lambda
  • IBM Cloud Functions
  • Auth0 WebTask
  • Azure
slide-16
SLIDE 16

From Zero to Serverless

Azure Serverless

16

Functions

Execute your code based

  • n events you specify

Logic Apps

Design workflows and

  • rchestrate processes

Event Grid

Manage all events that can trigger code or logic

slide-17
SLIDE 17

From Zero to Serverless

Azure Serverless

17

Functions

Execute your code based

  • n events you specify

Logic Apps

Design workflows and

  • rchestrate processes

Event Grid

Manage all events that can trigger code or logic

Storage Security IoT Analytics Intelligence Database

slide-18
SLIDE 18

Azure Functions

From Zero to Serverless

Events + data Code

slide-19
SLIDE 19

From Zero to Serverless

Azure Functions Architecture

19

App Service Dynamic Runtime

Hosting, CI, Deployment Slots, Remote Debugging, etc.

WebJobs Core

Programming model, common abstractions

WebJobs Extensions

Triggers, input, and output bindings

WebJobs Script Runtime

Azure Functions Host – Dynamic Compilation, Language abstractions, etc.

Language Runtime

C#, Node.js, F#, PHP, etc.

Code Config

slide-20
SLIDE 20

From Zero to Serverless

Features of Azure Functions

20

  • Choice of language
  • Pay-per-use pricing model
  • Bring your own dependencies
  • Integrated security
  • Simplified integration
  • Flexible development
  • Open-source

Batch

slide-21
SLIDE 21

From Zero to Serverless

Triggers and Bindings

21

Type Schedule HTTP (REST or webhook) Blob Storage Events Queues Queues and topics Storage tables SQL tables NoSQL DB Push Notifications Twilio SMS Text SendGrid Email Azure Functions Service Azure Functions Azure Storage Azure Event Hubs Azure Storage Azure Service Bus Azure Storage Azure Mobile Apps Azure Cosmos DB Azure Notification Hubs Twilio SendGrid Trigger Input Output

slide-22
SLIDE 22

From Zero to Serverless

Develop How You Want

22

  • Azure Portal
  • Quickly get started without having to install anything

else

  • Visual Studio 2017
  • First class C# development experience
  • Visual Studio Code
  • First class Node.js development experience
  • Edit any function project generated via CLI
  • Azure Functions Core Tools (CLI)
  • Build any kind of function and edit in IDE of your

choice

slide-23
SLIDE 23

From Zero to Serverless

Runtime Versions

23

  • .NET Framework 4.6
  • Generally Available

Runtime 1.x Runtime 2.x

  • .NET Core 2.0
  • Cross Platform
  • Language Extensions
  • Java
  • Binding Extensions
  • Microsoft Graph
  • Durable Functions
slide-24
SLIDE 24

From Zero to Serverless

Web Application Backends

24

slide-25
SLIDE 25

From Zero to Serverless

Mobile Application Backends

25

slide-26
SLIDE 26

From Zero to Serverless

Real-Time File Processing

26

slide-27
SLIDE 27

From Zero to Serverless

Real-Time Stream Processing

27

slide-28
SLIDE 28

From Zero to Serverless

Automation of Scheduled Tasks

28

slide-29
SLIDE 29

From Zero to Serverless

Extending SaaS Applications

29

slide-30
SLIDE 30

Demo 1: Create an Azure Function from the Portal

slide-31
SLIDE 31
slide-32
SLIDE 32
slide-33
SLIDE 33
slide-34
SLIDE 34
slide-35
SLIDE 35
slide-36
SLIDE 36
slide-37
SLIDE 37
slide-38
SLIDE 38

Demo 2: Create an Azure Function from Visual Studio

slide-39
SLIDE 39
slide-40
SLIDE 40
slide-41
SLIDE 41
slide-42
SLIDE 42
slide-43
SLIDE 43
slide-44
SLIDE 44
slide-45
SLIDE 45
slide-46
SLIDE 46
slide-47
SLIDE 47
slide-48
SLIDE 48
slide-49
SLIDE 49

From Zero to Serverless

Deployment and Monitoring

49

  • Visual Studio
  • Functions CLI
  • Visual Studio Team Services
  • Azure Resource Manager
  • Maven / Jenkins

Deployment Options Monitoring Options

  • Azure App Insights
  • Function Logs
  • Azure Monitor (preview)
slide-50
SLIDE 50

Demo 3: CI/CD

slide-51
SLIDE 51
slide-52
SLIDE 52
slide-53
SLIDE 53
slide-54
SLIDE 54
slide-55
SLIDE 55
slide-56
SLIDE 56
slide-57
SLIDE 57
slide-58
SLIDE 58
slide-59
SLIDE 59
slide-60
SLIDE 60
slide-61
SLIDE 61

From Zero to Serverless

Proxies

61

  • Provide more control over all functions or just select

methods

  • Can point to any HTTP resource

Take our current function url:

https://stirtrek.azurewebsites.net/api/HttpTriggerCSharp1?code=k9as3MKuDEA Oyj3GbniZgJjWrn1cMqTAcDhbzqgAldUcYk67EX8QVg==&name={name}

Our function URL would then be like this:

https://stirtrek.azurewebsites.net/HelloWorld/{name}

slide-62
SLIDE 62

Demo 4: Setting up routing and proxies

slide-63
SLIDE 63
slide-64
SLIDE 64
slide-65
SLIDE 65
slide-66
SLIDE 66
slide-67
SLIDE 67
slide-68
SLIDE 68
slide-69
SLIDE 69
slide-70
SLIDE 70
slide-71
SLIDE 71
slide-72
SLIDE 72

From Zero to Serverless

Securing your Azure Functions

72

  • HTTPTriggers can be protected by OAuth providers
  • Azure Active Directory
  • Microsoft Account
  • Facebook
  • Google
  • Twitter
slide-73
SLIDE 73

From Zero to Serverless

Function Timeouts

73

  • Default timeout of 5 minutes
  • Maximum timeout of 10 minutes
  • For longer running functions use the App Service

Plan and/or Durable Functions

slide-74
SLIDE 74

Pricing

From Zero to Serverless

slide-75
SLIDE 75

From Zero to Serverless

Pricing – General Information

75

  • No upfront cost
  • No termination fees
  • Pay only for what you use
slide-76
SLIDE 76

From Zero to Serverless

Pricing – Two Different Pricing Plans

76

  • Takes care of everything but your code
  • Pay only when your functions are running
  • Scale out automatically

Consumption Plan App Service Plan

  • You pretty much take care of everything
  • Consider when:
  • Existing, underutilized VMs
  • Function apps to run continuously
  • More CPU or memory options
  • Run longer than maximum execution

time

  • Require features only available on

App Service plan

  • Want to run on Linux (on general

availability tier)

slide-77
SLIDE 77

From Zero to Serverless

Pricing – Consumption Plan Details

77

  • Gigabyte-second (GB-s) – Combination of memory size and execution time
  • Executions – Each time a function is executed

Meter Price Free Grant Execution Time $0.000016 per Gb-s 400,000 GB-s Executions $0.20 per million executions 1 million executions

Pricing Example

  • Execution Time
  • 3 million executions x 1 second per execution = 3 million seconds
  • Resource consumption of 512-Mb → 1.5 million GB-s
  • 1.5 million GB-s minus grant of 400,000 Gb-s = 1.1 million Gb-s
  • Execution Total = $17.60
  • Executions
  • 3 million executions minus grant of 1 million executions = 2 million executions
  • 2 million transactions at 20 cents per million = $0.40
  • Grand Total: $18.00
slide-78
SLIDE 78

Best Practices

From Zero to Serverless

slide-79
SLIDE 79

From Zero to Serverless

The absolute minimum best practices

79

  • Functions should do one thing
  • Functions should be idempotent
  • Functions should finish as quickly as possible
slide-80
SLIDE 80

From Zero to Serverless

General Best Practices

80

  • Avoid long running functions
slide-81
SLIDE 81

From Zero to Serverless

General Best Practices

81

  • Avoid long running functions
  • Cross function communication
slide-82
SLIDE 82

From Zero to Serverless

General Best Practices

82

  • Avoid long running functions
  • Cross function communication
  • Write functions to be stateless
slide-83
SLIDE 83

From Zero to Serverless

General Best Practices

83

  • Avoid long running functions
  • Cross function communication
  • Write functions to be stateless
  • Write defensive functions
slide-84
SLIDE 84

From Zero to Serverless

Scalability Best Practices

84

  • Do not mix test and production code in the same

function app

slide-85
SLIDE 85

From Zero to Serverless

Scalability Best Practices

85

  • Do not mix test and production code in the same

function app

  • Use async code but avoid blocking calls
slide-86
SLIDE 86

From Zero to Serverless

Scalability Best Practices

86

  • Do not mix test and production code in the same

function app

  • Use async code but avoid blocking calls
  • Receive messages in batch whenever possible
slide-87
SLIDE 87

From Zero to Serverless

Scalability Best Practices

87

  • Do not mix test and production code in the same

function app

  • Use async code but avoid blocking calls
  • Receive messages in batch whenever possible
  • Configure host behaviors to better handle

concurrency

slide-88
SLIDE 88

From Zero to Serverless

Where to get started

88

  • Start small, replace 1 API or background processing

item

  • Integration is a great place, often it’s a new layer on

top of old layers

slide-89
SLIDE 89

Questions

chadgreen@chadgreen.com chadgreen.com ChadGreen ChadwickEGreen bit.ly/CCruise18