Web Apps や Functions ではスロット機能を利用することができるが、スロットでのアプリ設定周りで注意が必要そうな点について確認する。
スロット新規作成時の初期設定について
- Web Apps
- 初期設定としてコピーしたいアプリ設定のスロットを選択できる。未選択も可
- Functions
- Prd (運用) スロットのアプリ設定が常にコピーされる
スロット作成後のアプリ操作について (Web Apps, Functions 共通)
- 新規アプリ設定追加 / 既存アプリ設定削除 / 既存アプリ設定の値変更
- 当該スロットのアプリ設定としてのみ、追加 / 削除 / 値変更 される
- ワーカープロセスは再起動する
- 既存アプリ設定の「デプロイ スロットの設定」値変更 (「デプロイ スロットの設定」値変更のみ)
- 同名のアプリ設定が存在する全スロットに対して、「デプロイ スロットの設定」値変更が行われる
- ワーカープロセスは再起動しない
スロット作成後のアプリ操作については、「デプロイ スロットの設定」のみ、他の操作と異なる動きをする。

検証した限り、「デプロイ スロットの設定」は全スロット共通の設定として管理されているような動きだった。
また、アプリ設定の値とは直接関係ないため、「デプロイ スロットの設定」のみ変更された場合は、既存のワーカープロセス再起動は発生しない(新しい設定値を読み込む必要がないので、当たり前かもしれないけど)。
「デプロイ スロットの設定」値変更時の挙動だけ特殊なので、以下に検証結果を記載する。
ここでは Functions の HTTP トリガーに対してリクエストし続けた状態でアプリ設定を変更し、状況を観察する。
基本環境
| 対象 | 設定 |
|---|---|
| プラットフォーム | Function v3 (.NET Core) |
| OS | Windows |
| プラン | App Service プラン (S1) |
| インスタンス数 | 1 |
| 常時接続 | オン |
※ Functions HTTP トリガーのソースと、呼び出し側の PowerShell のソースは、以下で使用しているものと基本的に同じ。
設定値変更時の呼び出し結果
(FixAppSetting アプリ設定の値を、fixPrdxxx -> fixPrd に変更)
(1) [01/20 23:51:13] requesting...
Param: 1, AppVer: 2.0, FixAppSetting: fixPrdxxx, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 5360
(1) [01/20 23:51:15] response time: 2.32 (s)
(2) [01/20 23:51:15] requesting...
Param: 2, AppVer: 2.0, FixAppSetting: fixPrdxxx, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 5360
(2) [01/20 23:51:17] response time: 2.19 (s)
(3) [01/20 23:51:17] requesting...
Param: 3, AppVer: 2.0, FixAppSetting: fixPrdxxx, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 5360
(3) [01/20 23:51:19] response time: 2.18 (s)
(4) [01/20 23:51:19] requesting...
Param: 4, AppVer: 2.0, FixAppSetting: fixPrdxxx, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 5360
(4) [01/20 23:51:21] response time: 2.27 (s)
(5) [01/20 23:51:21] requesting...
The service is unavailable.
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod]、WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
+ PSComputerName : localhost
(5) [01/20 23:51:21] response time: 0.26 (s)
(6) [01/20 23:51:23] requesting...
The service is unavailable.
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod]、WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
+ PSComputerName : localhost
(6) [01/20 23:51:23] response time: 0.20 (s)
(7) [01/20 23:51:25] requesting...
Param: 7, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(7) [01/20 23:51:50] response time: 24.93 (s)
(8) [01/20 23:51:27] requesting...
Param: 8, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(8) [01/20 23:51:50] response time: 22.84 (s)
(9) [01/20 23:51:29] requesting...
Param: 9, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(9) [01/20 23:51:50] response time: 20.74 (s)
(10) [01/20 23:51:32] requesting...
Param: 10, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(10) [01/20 23:51:50] response time: 18.65 (s)
(11) [01/20 23:51:34] requesting...
Param: 11, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(11) [01/20 23:51:50] response time: 16.56 (s)
(12) [01/20 23:51:36] requesting...
Param: 12, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(12) [01/20 23:51:50] response time: 14.47 (s)
(13) [01/20 23:51:38] requesting...
Param: 13, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(13) [01/20 23:51:50] response time: 12.37 (s)
(14) [01/20 23:51:40] requesting...
Param: 14, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(14) [01/20 23:51:50] response time: 10.28 (s)
(15) [01/20 23:51:42] requesting...
Param: 15, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(15) [01/20 23:51:50] response time: 8.19 (s)
(16) [01/20 23:51:44] requesting...
Param: 16, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(16) [01/20 23:51:50] response time: 6.10 (s)
(17) [01/20 23:51:46] requesting...
Param: 17, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(17) [01/20 23:51:50] response time: 4.26 (s)
(18) [01/20 23:51:48] requesting...
Param: 18, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(18) [01/20 23:51:50] response time: 2.17 (s)
(19) [01/20 23:51:50] requesting...
Param: 19, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(19) [01/20 23:51:53] response time: 2.19 (s)
(20) [01/20 23:51:52] requesting...
Param: 20, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2,
SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684
(20) [01/20 23:51:55] response time: 2.19 (s)
上記結果からわかること
- 変更時にダウンタイムと遅延が発生している
- 新しいアプリ設定を読み込むため、ワーカープロセスの再起動が発生している
「デプロイ スロット設定」値のみ変更時の呼び出し結果
(1) [01/21 00:38:07] requesting... Param: 1, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (1) [01/21 00:38:09] response time: 2.46 (s) (2) [01/21 00:38:09] requesting... Param: 2, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (2) [01/21 00:38:11] response time: 2.19 (s) (3) [01/21 00:38:11] requesting... Param: 3, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (3) [01/21 00:38:14] response time: 2.92 (s) (4) [01/21 00:38:13] requesting... Param: 4, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (4) [01/21 00:38:16] response time: 2.81 (s) (5) [01/21 00:38:15] requesting... Param: 5, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (5) [01/21 00:38:17] response time: 2.18 (s) (6) [01/21 00:38:17] requesting... Param: 6, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (6) [01/21 00:38:19] response time: 2.19 (s) (7) [01/21 00:38:19] requesting... Param: 7, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (7) [01/21 00:38:22] response time: 2.18 (s) (8) [01/21 00:38:21] requesting... Param: 8, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (8) [01/21 00:38:24] response time: 2.20 (s) (9) [01/21 00:38:24] requesting... Param: 9, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (9) [01/21 00:38:26] response time: 2.19 (s) (10) [01/21 00:38:26] requesting... Param: 10, AppVer: 2.0, FixAppSetting: fixPrd, SwapAppSetting: swap2, SlotName: Production, ShortInstanceId: 4057cf, ProcessId: 4684 (10) [01/21 00:38:28] response time: 2.18 (s)
上記結果からわかること
- 変更時にダウンタイムと遅延が発生していない(変更されたかの判定も出来ないけど・・・)