Search code examples
devops-servicesazure-service-fabric

How can I block service escalation for specific Service Fabric nodes?


The problem occurs in a standalone Service Fabric cluster.

I need to publish my services to specified nodes that are on dedicated machines. I also want to block current services from allocating on the new node. I read about placement constraints and understand the idea, but when I add a new node to my Service Fabric cluster, a current service with an InstanceCount paramater set on -1 allocates on my new node. How can I avoid situations like this? Do I have to create a new node type? Or is there any constraint for it?


Solution

  • Service Fabric has the concept of NodeTypes, it is used to identify a pool of Nodes\Machines\VMs with equal configurations. If your workload has specific requirements that needs a specific hardware\software, a scenario can be a API receiving a job, and background job running a GPU computation application, and you want to isolate the load to these nodes to your specific applications, your have to:

    • Create a NodeType to host the API, let's call here FrontEntNodeType, that will be pool of resources that your apis will be deployed to. In your APIs service you have to add the placement constraint NodeType == FrontEntNodeType

    • Create a NodeType to host the Worker, lets call here GPUWorkerNodeType, In your worker services you have to add the placement constraint NodeType == GPUWorkerNodeType

    When you deploy your services, they will target the correct machines, and only services with GPUWorkerNodeType constraint will go to the GPU node to process work.

    The big catch of placement constraints is: if you don't specify a PlacementContraint on your service, it will go to any node available to receive load. So, it won't restrict older services that were deployed without placement constraints, you will have to update these to keep the cluster tidy.

    You can do the same using Node Properties, by default the nodes contains the properties NodeName & NodeType. You can have nodes with different framework versions participating on the same NodeType, if you want to upgrade the framework on some nodes to verify the load & behaviour before you apply to all nodes, you could upgrade a few nodes with a new framework version, add a NodeProperty to the node like DotNetFrameworkVersion=4.7, and put some services with DotNetFrameworkVersion==4.7 and other (DotNetFrameworkVersion!=4.7)

    You can find these information on the following link: https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-resource-manager-cluster-description#node-properties-and-placement-constraints