Moving from App Services to Azure Functions
A story of how we increased our throughput on Azure
1
Michelangelo van Dam
Co-founder/CEO In2it
PHP Community Leader
Open source contributor
CoderDojo Coach
MVP Azure
Moving	from	App	Services	to	Azure	Func5ons 2
How we did things in “the old days”
Bare metal servers in local DC
Optional virtualisation
Manual deployments
Releases after office hours
Moving	from	App	Services	to	Azure	Func5ons 3
Moving	from	App	Services	to	Azure	Func5ons 4
Web App
MySQL DB Redis Cache
Shared FS
Release drama
Broken packages
De-sync between staging and
production servers
Network issues
Hardware issues
Moving	from	App	Services	to	Azure	Func5ons 5
We needed better solutions!
Moving	from	App	Services	to	Azure	Func5ons 6
Discovery of the cloud in 2006
Moving	from	App	Services	to	Azure	Func5ons 7
It worked out initially…
VM’s for test, staging and production that were equal
Storage on S3
Moving	from	App	Services	to	Azure	Func5ons 8
Moving	from	App	Services	to	Azure	Func5ons 9
AWS	Cloud
S3
EC2
S3	-	Bucket
… but we encountered some cons
No cloud native database support
Very pricy for the services provided
Still lots of maintenance to keep our VM’s up-to-date
Moving	from	App	Services	to	Azure	Func5ons 10
Managed services
Infrastructure support for
Java, .Net and Ruby
Very costly on top of expensive
AWS bills
Lots of restrictions on what was
possible
Moving	from	App	Services	to	Azure	Func5ons 11
We needed better solutions!
Moving	from	App	Services	to	Azure	Func5ons 12
2008
Windows Azure intro by Josh
Holmes at MS Belux
Moving	from	App	Services	to	Azure	Func5ons 13
Windows Azure was what we needed!
Platform as a Service
You manage your app
Microsoft takes care of the platform and infrastructure
Separate services for database, cache and much more
Supported open source
Moving	from	App	Services	to	Azure	Func5ons 14
Automation!
Azure allowed us to fully automate the deployment processes
Moving	from	App	Services	to	Azure	Func5ons 15
Moving	from	App	Services	to	Azure	Func5ons 16
Classical Web Application Configuration
West Europe
PHP
Azure Services
Azure SQL
Storage Blob
Storage Queue
Sendgrid Services
North Europe
PHP
Azure Services
Azure SQL
Storage Blob
Storage Queue
Azure
Load Balancing
Replication
The DevOps movement
Moving	from	App	Services	to	Azure	Func5ons 17
Docker changed everything
Moving	from	App	Services	to	Azure	Func5ons 18
Some challenges
Docker containers are immutable
Persistence must be kept outside containers
Not a lot of examples and sources for best practices
Moving	from	App	Services	to	Azure	Func5ons 19
Moving	from	App	Services	to	Azure	Func5ons 20
PersistentFile
Sytem
Web Front Web Front Web Front Web Front
PHP-FPM PHP-FPM PHP-FPM
Worker Worker Worker
Say hello to Kubernetes
Moving	from	App	Services	to	Azure	Func5ons 21
Managed containers on Azure
AKS simplifies deployment and operations of Kubernetes
Dynamically scale application infrastructure
Security provided by Azure AD and Key Vault
Cost effective platform for container infrastructure
Moving	from	App	Services	to	Azure	Func5ons 22
Moving	from	App	Services	to	Azure	Func5ons 23
Internet
Azure AKS
POD POD
SCM
CI/CD
AKS Node
Azure Container
Registry
The serverless revolution
Moving	from	App	Services	to	Azure	Func5ons 24
Azure functions
Moving	from	App	Services	to	Azure	Func5ons 25
Azure Functions in a nutshell
Event-driven serverless compute platform
Build and debug locally
Deploy and operate at scale on Azure
Integrate services using triggers and bindings
Moving	from	App	Services	to	Azure	Func5ons 26
Inspired by Mr. Hunt
https://in2.se/hipb-serverless
Moving	from	App	Services	to	Azure	Func5ons 27
We want that too… but how?
Moving	from	App	Services	to	Azure	Func5ons 28
🤔
Where could we implement functions?
Most requests from customers: product details ✓
Most requests from employees: order and support tickets ✓
Most viewed page: sales and shipment dashboards ✓
Moving	from	App	Services	to	Azure	Func5ons 29
Moving	from	App	Services	to	Azure	Func5ons 30
How to get started?
Download the Azure Functions Core Tools
Moving	from	App	Services	to	Azure	Func5ons 31
https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local
Supported Technologies
Moving	from	App	Services	to	Azure	Func5ons 32
Technology V1 V2
C# GA (.NET Framework 4.7) GA (.NET Core 2)
JavaScript GA (Node 6) GA (Node 8 & 10)
F# GA (.NET Framework 4.7) GA (.NET Core 2)
Java N/A GA (Java 8)
Python Experimental Preview (Python 3.6)
TypeScript Experimental GA (supported through
transpiling to JavaScript)PHP Experimental N/A
Batch (.cmd, .bat) Experimental N/A
Bash Experimental N/A
PowerShell Experimental N/A
So how do I get started?
Create a directory
Init a “func” project
Write your logic
Run & Test locally
Push to Azure
Run it
Moving	from	App	Services	to	Azure	Func5ons 33
Live Demo 😱
Moving	from	App	Services	to	Azure	Func5ons 34
The impact of moving to functions
Moving	from	App	Services	to	Azure	Func5ons 35
0
480
960
1440
1920
2400
Sep 18 Oct 18 Nov 18 Dec 18 Jan 19 Feb 19 Mar 19 Apr 19
switch
containers ➤ functions
Our serverless journey has just begon
Moving	from	App	Services	to	Azure	Func5ons 36
DONE TO DO
Product details Procurement
Incoming Orders Shipping
Callback requests Customer history
KPI Dashboards Stock management
Portal advertisements
Customs declarations
Commercial mailings
Content management
Import regulation management
Some takeaways
Prepare for the “next best thing” and have a loosely coupled code base
Always experiment! It might be good today, but can it be better tomorrow?
Azure offers all required tools to get started, but choosing the “right” tool is
the hardest part
Moving	from	App	Services	to	Azure	Func5ons 37
Our most important lessons
Do not create a new client with every function invocation (RTFM)
Fail early by keeping timeouts as small as possible
Moving	from	App	Services	to	Azure	Func5ons 38
39
Moving	from	App	Services	to	Azure	Func5ons 40
www.in2it.be

Moving from app services to azure functions