26
Operation and Management with Azure Functions. Serverless Meetup Tokyo #2 2017/01/17 Jun Kudo

Operation and Management with Azure Functions

Embed Size (px)

Citation preview

Page 1: Operation and Management with Azure Functions

Operation and Managementwith Azure Functions.

Serverless Meetup Tokyo #22017/01/17

Jun Kudo

Page 2: Operation and Management with Azure Functions

Who?Name• Jun Kudo ( じゅん くどう )

Keyword• iret Inc. cloudpack• Microsoft MVP for Azure• 社団法人 LOCAL( 北海道 ) • 情報セキュリティ勉強会 ( 江戸前、札幌 )• オープンソースカンファレンス北海道• JAZUG/JWASUG• Serverless• LinuxCon• ISOC-JP

SNS• Facebook > level69• Twitter > jkudo

Page 3: Operation and Management with Azure Functions

Azure Functions

Page 4: Operation and Management with Azure Functions

Azure Functions超要約AWS で言う Lambda みたいなもの(って誰かが言ってましたEC2 プラットフォームではなく、 AppService プラットフォームを拡張したもの。

開発手法言語: JavaScript 、 Node.js 、 C# 、 Python 、 PHP 、 F#スクリプト: Bash 、 Batch 、 PowerShellなかには: Perl 、 Ruby なんかもNuGet パッケージの導入も可能

Page 5: Operation and Management with Azure Functions

Azure FunctionsDevOps の統合(継続的インテグレーション)• Visual Studio Team Services• GitHub• BitBucketモニタリングやトラブルシューティングも行える。

価格( SLA99.95 )従量制課金 料金 無料提供(月々)実行時間 ¥0.001632/GB 秒 400,000 GB 秒総実行回数 100 万実行回数あたり ¥20.40 100 万実行回数

Page 6: Operation and Management with Azure Functions

様々なバインド• タイマートリガー ( スケジュール )• HTTP(RETS or Webhook)• BLOB ストレージ (Azure Storage)• イベント (Azure Event Hubs)• キュー (Azure Storage)• テーブル (Azure Storage)• テーブル (Azure Mobile Apps)• NoSQL DB(Azure Document DB)• プッシュ通知 (Azure Notification Hubs)• Twilio SMS テキスト (Twilio)• Box 、 DropBox 、 OneDrive 、 SendGrid など

Page 7: Operation and Management with Azure Functions

シナリオタイマーベースの処

Azure サービスのイベント処理

SaaS イベント処理

サーバーレス Web アプリケーション アーキテクチャ

サーバーレス モバイル バックエンド

リアルタイム ストリーム処理

リアルタイム ボット メッセージング

Page 8: Operation and Management with Azure Functions

さて本題です。

Page 9: Operation and Management with Azure Functions

ServerlessServerless を運用するのにサーバーを立てますか?Azure Functions に限らず、 AWS Lambda 、 Google Cloud Functions でのログや、監視に大きな課題を抱えている。

Serverlessconf London 2016 : Patrick Debois 氏 基調講演

実際に、 Serverless 開発しリリースを行ったら当然のように運用監視が必要となります。

Page 10: Operation and Management with Azure Functions

ではAzure Functionsではどのように運用していくか

非常に多くのツールが用意されています。

Page 11: Operation and Management with Azure Functions

Azure Functions

ログの取得

Recent success countRecent errors countdetailes

Page 12: Operation and Management with Azure Functions

Azure Functions Pulse

リアルタイムにグラフ化

• Executions Started/Sec• Executions Completed/Sec• Executions Failed/Sec• Avg. Execution Time(ms)

Page 13: Operation and Management with Azure Functions

Azure Cli

ログの Tail が可能

azure site log tail -v <function app name>

Page 14: Operation and Management with Azure Functions

Azure Powershell

ログの Tail が可能

PS C:\> Get-AzureWebSiteLog -Name MyFunctionApp -Tail

Page 15: Operation and Management with Azure Functions

でも、長期のログ可視化が行えない。

Page 16: Operation and Management with Azure Functions

ログの保存

実際は残っているけど。

可視化を行えない。

Page 17: Operation and Management with Azure Functions

Application Insightsproject.json を用意する。

NuGet が実行され、“ Microsoft.ApplicationInsights”: “2.2.0” を導入する。

App Service Setting を行う。

Timer トリガーの Functionsを設定。

Application Insights と連携( Key の指定)する。

最大 90 日の保存期間

それ以上も連続エクスポート機能によりストレージに保存可能

1 分精度は 30 日

1 時間 or1 日精度は 90 日

Page 18: Operation and Management with Azure Functions

Application Insights > Analytics多彩なクエリによる分析グラフ化を行える。

Page 19: Operation and Management with Azure Functions

Application Insights > Alert閾値の指定メールによるアラートWebhook によるアラート様々なサービスと連携できます• PagerDuty• Datadog• Slack• etc?

Page 20: Operation and Management with Azure Functions

Application Insights > スマート検知機能失敗の異常機械学習による障害発生率のアラート

パフォーマンスの異常応答時間、障害発生率の異常なパターンを毎日検索

Azure クラウドサービスの問題サービスのアラート

マイクロソフトのドキュメントより画像転載

Page 21: Operation and Management with Azure Functions

さらに統合して運用管理を行いたい場合

Page 22: Operation and Management with Azure Functions

Microsoft Operations Management Suite (OMS)

様々な Azure サービスのログを収集し解析できる。• ログの解析• アラートの設定• PowerBI へプッシュ• オンプレとの統合

Application Insights と連携することができる。

マイクロソフトのドキュメントより画像転載

Page 23: Operation and Management with Azure Functions

OMS Log Analytics > アラート

Azure Automation  による自動化• Runbook

マイクロソフトのドキュメントより画像転載

Page 24: Operation and Management with Azure Functions

OMS Log Analytics > PowerBI

PowerBI での可視化グラフ、 Excel でエクスポート

マイクロソフトのドキュメントより画像転載

Page 25: Operation and Management with Azure Functions

まとめ

Azure Functions を起点としServerless な運用が可能

• Azure Functions 標準機能• Application Insights• Microsoft Operations Management Suite (OMS)• サードパーティーサービスの連携

他にも取り上げなかった、 Azure サービスとの柔軟な連携が可能

Page 26: Operation and Management with Azure Functions

Thanks.