Blog Post

Azure PaaS Blog
2 MIN READ

Preserve Disk space in ImageStore for Service Fabric Managed Clusters

Ahmed_Khaled's avatar
Ahmed_Khaled
Icon for Microsoft rankMicrosoft
Apr 30, 2024

As mentioned in this article: Service Fabric: Best Practices to preserve disk space in Image Store ImageStore keeps copied packages and provisioned packages.

In this article, we will discuss how can you configure cleaning up the copied application package for Service Fabric Managed Cluster 'SFMC'.

 

The mitigation is to set "AllowRuntimeCleanupUnusedApplicationTypesPolicy": "true".

For properties, specify the following tags:

...

    "applicationTypeVersionsCleanupPolicy": {

      "maxUnusedVersionsToKeep": 3

    }

 

Let me show you a step-by-step guide to automatically remove the unwanted application versions in your Service Fabric Managed cluster below:

 

Scenario:

- I have deployed 4 versions of my app (1 InUse - 3 UnUsed) to my managed cluster as the following:

 

Symptom:

I need Service Fabric to do automatic cleanup for the Application Unused Versions and keep only the last 3 so as not to fill the disk space.

 

Mitigation Steps:

  1. From https://resources.azure.com/ open your managed cluster resource and open the read/write mode.
  1. Add the tag "AllowRuntimeCleanupUnusedApplicationTypesPolicy": "true"

 

 

  1. Under fabricsettings, add the param "name": "CleanupUnusedApplicationTypes", "value": "true" under fabricsettings and set the "maxUnusedVersionsToKeep":

 

 

  1. Click on PUT to save the changes, and I deployed the 5th version (1.0.4) to the cluster, which should make the cleaning happens for the oldest version (1.0.0)

 

Note: The automatic clean-up should be effective after 24 hours of making those changes.

 

Then I tried to deploy a new version, and I could see that the oldest version was also cleaned up.

 

For manual cleanup of the ImageStoreService:

You can use PowerShell commands to delete copied packages and unregister application types as needed.

This includes using Get-ServiceFabricImageStoreContent to retrieve content and Remove-ServiceFabricApplicationPackage to delete it, as well as Unregister-ServiceFabricApplicationType to remove application packages from the image store and image cache on nodes.

Updated Apr 30, 2024
Version 1.0
No CommentsBe the first to comment