Callon Campbell
Solutions Architect | Developer | Microsoft MVP
Cloud Mavericks Inc.
Developing scalable enterprise
serverless applications with
.NET
Microsoft Azure
Callon Campbell
Solution Architect | Developer
Microsoft MVP in Azure
He/him/his
Speaker introduction
• 20 years enterprise development with Microsoft technologies – .NET, Azure,
Web, Desktop, SQL, and Mobile
• Blogging at https://theflyingmaverick.com
• Speaker at community events and meetups
• Co-creator of ReflectInsight, a live .NET log viewer
Microsoft Azure
Agenda
•Goals of serverless
•Adopting serverless and cloud native for your
application architecture
•Building for scale, high availability and resiliency
•Real world example – code and demos
•Q&A
3
Microsoft Azure
The goals of “serverless”
Microsoft Azure
Serverless
Full abstraction of servers
Instant scale
Pay-per-use
Microsoft Azure
Microsoft Azure
Leader in Functions-as-a-Service
platform
Forrester has named Microsoft as a leader in the inaugural
report, The Forrester New Wave™: Function-As-A-Service
Platforms, Q1 2020 based on their evaluation of Azure Functions
and integrated development tooling.
“robust programming model and integration capabilities”
"engineering and support teams as key to their success”
Report:
https://reprints.forrester.com/#/assets/2/108/RES155938/reports
Microsoft Azure
Full abstraction of
servers
Instant scale
Pay-per-use
Serverless for the enterprise
Development process flexibility
Secure and compliant
Enterprise-level scale with control
Advanced observability
Hybrid and multi-cloud
Microsoft Azure
Adopting serverless and cloud
native
Microsoft Azure
Azure serverless ecosystem
Event driven serverless offerings…
Microsoft Azure
Azure serverless ecosystem
Microsoft Azure
Azure Functions
Microsoft Azure
PlatformApplicationdeliveryOperatingsystem
●●● ●●●
●●●
+
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
●●●
Functions everywhere
Microsoft Azure
Scale and latency
Microsoft Azure
Cold-starts
• When choosing the ‘Consumption’ plan, you will have elastic
scale but at the cost of cold starts.
• A cold-start is a small amount of time needed to warm up the
resources and execute your functions. Consumption plan runs
on a shared environment and resources need to be allocated.
• Cold-start could take 1-3 seconds.
15
Microsoft Azure
Premium Functions
• Avoid cold-start with perpetually warm instances
• Dynamically scale as needed
• Consistent performance
• Network isolation, VNet connectivity
• Long running execution (60min guaranteed)
• Better predictable pricing
16
Microsoft Azure
Premium Functions recap
Powerful hardware
Elastic scale with control
Advanced networking options
Reserved instances
Microsoft Azure
Running healthy apps in the
cloud
Microsoft Azure
Use multiple instances & deploy to
multiple regions
19
Multiple instances:
• Azure Functions provides the means to automatically scale when needed
• Allocate minimum instances in the Scale out (App Service Plan) blade
• Set number of pre-warmed instances
Deploy to multiple regions:
• Leverage Azure Front Door or Traffic Manager to intercept traffic before it hits your site
• Helps with routing and distribution between your instances and regions
• Route incoming requests based on the customer’s geography
Microsoft Azure
Leverage deployment slots
20
Why use slots?
• Different environments for different
purposes – test your changes
• Prewarming
• Easy fallbacks
How are functions affected by swapping slots?
• Traffic redirection is seamless; no requests
are dropped because of a swap.
• If a function is running during a swap,
execution continues, and the next triggers
are routed to the swapped app instance.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots
Microsoft Azure
Cosmos DB
21
SQL-API
• Write scalability around the
world
• Low latency (<10ms P99 for 1kb
document) writes around the
world
• 99.999% High Availability around
the world
• Well-defined consistency models
• Automatic conflict management
Microsoft Azure
Storage (RS-GRS)
22
READ-ACCESS GEO-REDUNDANT STORAGE
Redundancy in the primary region
• Locally redundant storage (LRS) copies your data synchronously three times within a single
physical location in the primary region.
• Zone-redundant storage (ZRS) copies your data synchronously across three Azure availability
zones in the primary region.
Redundancy in a secondary region
• Geo-redundant storage (with GRS or GZRS) replicates your data to another physical location
in the secondary region to protect against regional outages.
• Design your applications for read access to the secondary region.
Microsoft Azure
Enable Application Insights
23
Application map
Live metrics stream
Search
Failures
Performance profiling
Track dependencies
Microsoft Azure
On-prem
Real world
sample
Azure Function app to integrate
into Twilio calls and messaging
platform.
Global scale, availability, resiliency.
Secure access to on-prem
resources.
24
AzureTwilio
Calls
Messages
Caller
Recipient
Microsoft Azure
On-prem
25
AzureTwilio
Calls
Messages
Caller
Recipient
Hybrid
Connection
Manager
SQL Server
Traffic
Manager
Data Factory
(ETL pipeline)
Cosmos DB
SQL API
Logic App
App Configuration
MediaFile
StartCall
PostCall
Blob
Storage
Queue
Storage
Hybrid Connection
ProcessCall
PostCall
Orchestrator
API
Management
Call Details
Microsoft Azure
Azure Traffic Manager
Azure - West US 2
Azure - Global
Managed Service
Azure - East US 2
http://tm-enterpriseserverless-01.trafficmanager.net/api/startcall
27
DNS-BASED LOAD BALANCING
• Flexible routing options
• Priority, performance, geographic,
weighted round-robin, subnet, and
multi-value
• Reduce application downtime
• Improve app performance and
content delivery
• Distribute user traffic over multiple
locations
• Use with your on-premises
datacenter
• Geographic fencing of your
application users
Demos
Start coding
Microsoft Azure
Demo notes
• Twilio test call and SMS
• Premium Function
• Warmed instances
• Deployment slots
• Cosmos DB geo replication + multi-master + Autoscale
• Storage (RS-GRS)
• Configure for secondary URL
• Traffic Manager
• App Configuration
29
Microsoft Azure
Developer productivity
Microsoft Azure
Tooling
Develop and test locally and disconnected from Azure
using:
• Visual Studio and/or Visual Studio Code
• Cosmos DB Emulator
• Microsoft Azure Storage Emulator
• Microsoft Azure Storage Explorer
• .NET Core 3.1, Function runtime v3, Cosmos DB SQL API
31
Microsoft Azure
Inner and outer loop development
Inner Loop
Source
Control
Build and
Test (CI)
Deploy
(CD)
Run
(Prod)
Monitoring
&
Diagnostics
Code,
Run,
Debug
Outer Loop
Microsoft Azure
Getting code to the cloud
Direct publish App Service SCM (Kudu) CI/CD tools
“right click publish”
CD CD
CI
Check-in Check-in
Microsoft Azure
Operations
Using a combination of Event Grid and Logic Apps
•Event Grid listing to changes to storage account
and triggers a Logic App to synchronize media files
across regions.
•Logic App monitors Poison queue in storage and
reprocesses.
34
Microsoft Azure
Logic App workflows
35
Demos
Start coding
Microsoft Azure
Demo notes
•Develop and debug locally
•Azure Pipelines
• Build
• deploy
•Monitoring
37
Microsoft Azure
Wrapping it up
Microsoft Azure
Your applications could
benefit from serverless
today.
Microsoft Azure
Wrap-up
Serverless is the next big thing for enterprise. Pick what
works for you
Serverless is more than just compute, functions, and app
development
Productivity does not preclude enterprise capability
Microsoft Azure
Resources
Session Materials on GitHub
Session Resources
https://github.com/calloncampbell/Enterprise-Serverless-Demo/
All in one resource:
https://github.com/calloncampbell/Enterprise-Serverless-Demo/blob/master/RESOURCES.md
Get Certified
Microsoft Azure
https://LinkedIn.com/in/CallonCampbell
@flying_maverick
Callon@CloudMavericks.ca
https://GitHub.com/CallonCampbell
Let’s connectLet’s connect
Microsoft Azure
Thank You

Developing scalable enterprise serverless applications on azure with .net