Azure Service Fabric
Â
Intro
Similar to Kubernetes, Service Fabric is Microsoft's container orchestrator for deploying and managing microservices across a cluster of machines
Documentation
Â
Tips and Tidbits
 You can use the Service Fabric programming model or run containerized stateful services written in any language or code.
You can create Service Fabric clusters anywhere, including Windows Server and Linux on premises and other public clouds, in addition to Azure.
Linux-based Service Fabric do not support Application Insights
Service Fabric provides a sophisticated, lightweight runtime that supports stateless and stateful microservices.Â
By default, Service Fabric deploys and activates services as processes.
Service Fabric can also deploy services in containers.
Service Fabric supports deployment of Linux containers and Windows containers on Windows Server 2016 and later.
Container images can be pulled from any container repository and deployed to the machine.
You can deploy existing applications as guest executables, Service Fabric stateless or stateful Reliable services or Reliable Actors in containers, and you can mix services in processes and services in containers in the same application.
Â
A node type defines the size, number, and properties for a set of nodes (virtual machines) in the cluster.
Every node type that is defined in a Service Fabric cluster maps to a virtual machine scale set.
Because each node type is a distinct scale set, it can be scaled up or down independently, have different sets of ports open, and have different capacity metrics.
Each cluster requires one primary node type, which runs critical system services that provide Service Fabric platform capabilities.
Although it's possible to also use primary node types to run your applications, it's recommended to dedicate them solely to running system services.
Non-primary node types can be used to define application roles (such as front-end and back-end services) and to physically isolate services within a cluster.
Service Fabric clusters can have zero or more non-primary node types.
Use Silver or Gold durability for all node types that host stateful services you expect to scale-in frequently, and where you wish deployment operations be delayed and capacity to be reduced in favor of simplifying the process. Scale-out scenarios should not affect your choice of the durability tier.
Â
Durability tier | Required minimum number of VMs | Supported VM Sizes |
---|---|---|
Gold | 5 | Full-node sizes dedicated to a single customer (for example, L32s, GS5, G5, DS15_v2, D15_v2) |
Silver | 5 | VMs of single core or above with at least 50 GB of local SSD |
Bronze | 1 | VMs with at least 50 GB of local SSD |
Package an application
Â
The application manifest, one or more service manifests, and other necessary package files must be organized in a specific layout for deployment into a Service Fabric cluster
The folders are named to match the Name attributes of each corresponding element.
Â
Create a SetupEntryPoint if you need to run an executable before the service starts or if you need to perform an operation with elevated privileges
Build the package usingÂ
msbuild.exe
Test the package using the Test-ServiceFabricApplicationPackage command.
This command checks for manifest parsing issues and verify all references.
This command only verifies the structural correctness of the directories and files in the package.
It doesn't verify any of the code or data package contents beyond checking that all necessary files are present.
When a package is large or has many files, you can compress it for faster deployment
Copy-ServiceFabricApplicationPackage withÂ
CompressPackage
 switch
Starting with version 6.1, Service Fabric allows provisioning from an external store.
With this option, the application package doesn't have to be copied to the image store. Instead, you can create anÂ
sfpkg
 file and upload it to an external store, then provide the download URI to Service Fabric when provisioning.The same package can be provisioned to multiple clusters. Provisioning from the external store saves the time needed to copy the package to each cluster.
TheÂ
sfpkg
 file is a zip that contains the initial application package and has the extensionÂ.sfpkg
. Inside the zip, the application package can be compressed or uncompressed.To create anÂ
sfpkg
 file, start with a folder that contains the original application package, compressed or not.Then, use any utility to zip the folder with the extension ".sfpkg". For example, use ZipFile.CreateFromDirectory.