visual studio team services を使った serverless のための継続的デリバリ
TRANSCRIPT
Microsoft Tech Summit 2017
Visual Studio Team Services を使ったServerless のための継続的デリバリー
Microsoft Tech Summit 2017
モダンな開発スタイル
Microsoft Tech Summit 2017
継続的デリバリ
Microsoft Tech Summit 2017
Serverlessを始めてほしい
Redmond Microsoft campus
Data Factory
Blob StorageKey Vault
Storage Queue
Event Hub
Stream Analytics
Log AnalyticsPower BI
SQL Server
Azure SQL Server
Redis Cache
Serverless 地獄
地獄
地獄
地獄
地獄
Function App
Function
Function
Function
AppSettingsConnection
Strings
面倒
地獄(再掲載)
地獄(再掲載)
テスト
リリース
地獄(再掲載)
Ver 2.0
Data Factory
Blob StorageKey Vault
Storage Queue
Event Hub
Stream Analytics
Log AnalyticsPower BI
SQL Server
Azure SQL Server
Redis Cache
(再掲載)
AppSettingsEndpointA: xxx
AppSettingsEndpointB: xxx
地獄(再掲載)
Data Factory
Blob StorageKey Vault
Storage Queue
Event Hub
Log Analytics
SQL ServerRedis Cache
Terraform / ARM
Logic Appどうするよ?
Visual Studio でローカル開発する
Architecture
Orchestration – Manage the Complexity
Durable Functions – Orchestrators for Azure Functions
Reduce Complexity Simplify
Enable Long Running FunctionsEnable
Orchestrate Functions Coordinate
Why do we need “Durable Functions”
Long Running & Local State
01Simplify Function Coordination
02Easy Function Communication
03Code-Only
04
What is Durable Functions?
Automatic Save of Local State
03No JSON schemas,
No designer!
01Sync & Async Functions Calls
02
F1 F2 F3 F4
// calls functions in sequencepublic static async Task<object> Run(DurableOrchestrationContext ctx){
try{
var x = await ctx.CallFunctionAsync("F1");var y = await ctx.CallFunctionAsync("F2", x);var z = await ctx.CallFunctionAsync("F3", y);return await ctx.CallFunctionAsync("F4", z);
}catch (Exception){
// global error handling/compensation goes here}
}
F1
F2
F3
public static async Task Run(DurableOrchestrationContext ctx){
var parallelTasks = new List<Task<int>>();
// get a list of N work items to process in parallelobject[] workBatch = await ctx.CallFunctionAsync<object[]>("F1");for (int i = 0; i < workBatch.Length; i++){
Task<int> task = ctx.CallFunctionAsync<int>("F2", workBatch[i]);
parallelTasks.Add(task);}
await Task.WhenAll(parallelTasks);
// aggregate all N outputs and send result to F3int sum = parallelTasks.Sum(t => t.Result);await ctx.CallFunctionAsync("F3", sum);
}
Worker
Worker
Worker
Worker
WorkerStateful/Partitioned
Stateless
Control Queue(s)Triggers orchestrator
function execution
Work Item QueueTriggers activity function execution
History & Instance Tables
Key Takeaways - Orchestrator functions
Code Stateful Durable
When sleeping, not
billed
Automatically wake up
Scalable
Serverlessを始めてみよう
https://github.com/Azure-Samples/azure-serverless-workshop-
team-assistant/tree/lang/jp
https://blogs.msdn.microsoft.com/kenakamu/
• Azure WebJobs SDK Script: https://github.com/Azure/azure-webjobs-sdk-script
• Azure Functions CLI: https://github.com/Azure/azure-functions-cli
• Durable Functions: https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-overview
• Azure Samples: https://azure.microsoft.com/en-us/resources/samples/?sort=0&service=functions
• Logic Apps: https://github.com/logicappsio
• Event Grid: https://docs.microsoft.com/en-us/azure/event-grid/overview