View
60
Download
1
Category
Preview:
Citation preview
Serverless Azure
Mark Allan (@MarkXA)
Server evolution VMs PaaS Containers Functions
“Serverless” computing Servers abstracted away Still your code and data Elastic scale Elastic price Minimal admin
Serverless on Azure Code: Azure Functions Data: Azure Storage, DocumentDB Workflow: Logic Apps APIs: Cognitive Services
DocumentDB
Document databases NoSQL Keyed and partitioned documents Schema-free – JSON (or XML) Scalable No need for ORMs See also: AWS DynamoDB, Apache
CouchDB, MongoDB (PostgreSQL), etc
DocumentDB Developed cloud-first by SQL Server team Database As A Service Fully managed “Web scale” storage and throughput SSD storage SQL query syntax Emulator available for dev/test
DEMOCreating a database
Resource hierarchy
Regions
Partitioning Single partition collection• Keyed on ID• Max 10GB (hard)• 400 - 10,000 RU/s (hard)
Partitioned collection• Keyed on ID and partition key• Max 250GB (soft)• 2,500 - 250,000 RU/s (soft)
Querying SQL-based query syntax Extensions such as IS_DEFINED,
IS_ARRAY, IS_NUMBER, ARRAY_CONTAINS, ARRAY_SLICE, ST_DISTANCE
SPs, UDFs and triggers in JS Transactions LINQ-style filter(), map(), flatten(),
sortBy()
DEMOQuery Playground
Consistency levels Strong Bounded staleness Session (default) EventualSet at collection level, can be relaxed
Indexing Everything indexable by default Intelligent indexing based on usage Opt in/out for paths and documents Hash, range, spatial indexes (with precision) GeoJSON points, polygons etc Consistent and lazy policies (and none) Indexes do add to cost
Security Full access via master keys (or read-
only) Users restricted to specified
resources User-level access via 1-5hr resource
tokens
APIs RESTful HTTP .NET (traditional, Core, Xamarin) Java, Python, Node, C++ APIs wrap HTTP, add e.g. retry logic
DEMODocumentDB APIs
Integration HDInsight Azure Search Azure Data Factory (backups) Data Migration Tool Power BI Change feed
Pricing Storage – by usage Throughput – reserved capacity 1 RU = GET by ID of 1KB doc Capacity planner + pricing calculator
Useful resources Homepage:
https://azure.microsoft.com/en-us/services/documentdb/
Query Playground: https://www.documentdb.com/sql/demo
Capacity Planner: https://www.documentdb.com/capacityplanner
Pricing Calculator: https://azure.microsoft.com/en-us/pricing/calculator/?service=documentdb
.NET API samples: https://github.com/Azure/azure-documentdb-dotnet
Azure Functions
Azure Functions “Functions as a Service” Async functions triggered by events Evolution of App Service webjobs New: Consumption plans See also: AWS Lambda, Google Cloud
Functions, Apache OpenWhisk
A function
AzureFunction
Trigger
Inputs
Outputs
More functions
Poll feed
Create thumbnails
API request
Triggers Schedule HTTP (API or webhooks) Storage Queue Storage Blob Service Bus Queue / Topic Event Hub
Inputs Storage Table Storage Blob Mobile Apps Table DocumentDB
Outputs HTTP response (for HTTP trigger) Storage Queue / Blob / Table Service Bus: Queue / Topic Mobile Apps Table DocumentDB Event Hub Notification Hub Twilio
Integrations Flow PowerApps
Languages First-class: NodeJS, C#, F# “Experimental”: Python, PHP, Bash,
Powershell, Batch (!) Future: Java
DEMOCreating functions
Tooling Azure Functions CLI Visual Studio .funproj Serverless Framework Soon: full VS - proper unit testing etc
Challenges Latency Stateless – caching etc Non-scalable components (e.g. SQL) Bugs can be expensive Vendor lock-in
Thank you!
Any questions?
Recommended