You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: This article covers some advanced topics pertaining to upgrading a Service Fabric application.
4
4
5
5
ms.topic: conceptual
6
-
ms.date: 2/23/2018
6
+
ms.date: 1/28/2020
7
7
---
8
-
# Service Fabric application upgrade: advanced topics
9
-
## Adding or removing service types during an application upgrade
8
+
# Service Fabric application upgrade: Advanced topics
9
+
10
+
## Add or remove service types during an application upgrade
11
+
10
12
If a new service type is added to a published application as part of an upgrade, then the new service type is added to the deployed application. Such an upgrade does not affect any of the service instances that were already part of the application, but an instance of the service type that was added must be created for the new service type to be active (see [New-ServiceFabricService](https://docs.microsoft.com/powershell/module/servicefabric/new-servicefabricservice?view=azureservicefabricps)).
11
13
12
14
Similarly, service types can be removed from an application as part of an upgrade. However, all service instances of the to-be-removed service type must be removed before proceeding with the upgrade (see [Remove-ServiceFabricService](https://docs.microsoft.com/powershell/module/servicefabric/remove-servicefabricservice?view=azureservicefabricps)).
13
15
16
+
## Avoid connection drops during planned downtime of stateless services
17
+
18
+
For planned stateless instance downtime, like when the application/cluster is upgraded or nodes are getting deactivated, there are a few connections drops which are observed because the endpoint exposed by the instances is removed after it goes down.
19
+
20
+
To avoid getting connections drops for planned downtime, the request drain feature has been enabled which can be configured by adding a replica close delay duration in the service configuration. This would be used to delay the close of the stateless Instance. The endpoint advertised by the stateless Instance is removed, before we start the delay timer prior to closing this Instance. This delay duration would give existing requests to drain gracefully before the instance actually goes down. This endpoint change is advertised to the clients, and they would have to resolve the endpoints again, so that they do not send new requests to the instance which is going down.
21
+
22
+
### Service configuration
23
+
24
+
The delay can be configured in the service in following ways:
25
+
26
+
#### When creating a new service
27
+
28
+
By setting an `-InstanceCloseDelayDuration` value:
Since we remove the endpoint advertised by an instance and then start the delay timer before we close the Instance down, the clients will get a change notification for the endpoints updated for which they would need to register a callback (`ServiceManager_ServiceNotificationFilterMatched`) like this:
The change notification is an indication that the endpoints have changed, the client should re-resolve the endpoints, and not use the endpoints which are not advertised anymore as they will go down soon.
72
+
73
+
### Optional upgrade overrides
74
+
75
+
Apart from the pre-configured delay duration, you also have the option to override the delay, at the time of initiating an application/cluster upgrade using the same (`InstanceCloseDelayDurationSec`) option:
This delay duration will only be valid for this instance of the upgrade and will not change the individual service delay configurations. For example, you can use this to give a 0 delay, to run through an upgrade and not wait for the pre-configured delay.
84
+
85
+
86
+
14
87
## Manual upgrade mode
88
+
15
89
> [!NOTE]
16
90
> The *Monitored* upgrade mode is recommended for all Service Fabric upgrades.
17
91
> The *UnmonitoredManual* upgrade mode should only be considered for failed or suspended upgrades.
@@ -25,6 +99,7 @@ In *UnmonitoredManual* mode, the application administrator has total control ove
25
99
Finally, the *UnmonitoredAuto* mode is useful for performing fast upgrade iterations during service development or testing since no user input is required and no application health policies are evaluated.
26
100
27
101
## Upgrade with a diff package
102
+
28
103
Instead of provisioning a complete application package, upgrades can also be performed by provisioning diff packages that contain only the updated code/config/data packages along with the complete application manifest and complete service manifests. Complete application packages are only required for the initial installation of an application to the cluster. Subsequent upgrades can either be from complete application packages or diff packages.
29
104
30
105
Any reference in the application manifest or service manifests of a diff package that can't be found in the application package is automatically replaced with the currently provisioned version.
While upgrades can be rolled forward in one of three modes (*Monitored*, *UnmonitoredAuto*, or *UnmonitoredManual*), they can only be rolled back in either *UnmonitoredAuto* or *UnmonitoredManual* mode. Rolling back in *UnmonitoredAuto* mode works the same way as rolling forward with the exception that the default value of *UpgradeReplicaSetCheckTimeout* is different - see [Application Upgrade Parameters](service-fabric-application-upgrade-parameters.md). Rolling back in *UnmonitoredManual* mode works the same way as rolling forward - the rollback will suspend itself after completing each UD and must be explicitly resumed using [Resume-ServiceFabricApplicationUpgrade](https://docs.microsoft.com/powershell/module/servicefabric/resume-servicefabricapplicationupgrade?view=azureservicefabricps) to continue with the rollback.
0 commit comments