Search code examples
azureazure-service-fabric

Scaling of Azure service fabric Stateless services


Can you please give me a better understanding of how we can scale the stateless services without partitioning?

Say we have 5 nodes in a cluster and we have 5 instances of the service. On simple testing a node is behaving as sticky where all the requests I am sending are being served by only one node. In the scenario when we have high volume of requests that come in, can other instances be automatically used to serve the traffic. How do we handle such scale out situations in service fabric?

Thanks!


Solution

  • Usually there's no need to use partitioning for stateless SF services, so avoid that if you can:

    more on SF partitioning, including why its not normally used for stateless services

    If you're using the ServiceProxy API, it will maintain sticky connections to a given physical node in the cluster. If you're (say) exposing HTTP endpoints, you'll have one for each physical instance in the cluster (meaning you'll end up talking to one at a time, unless you manually cycle thru them). You can avoid this by:

    1. Creating a new proxy instance for each call, which tends to be expensive if you do it alot (or manually cycle thru the list of instance endpoint URLs, which can be tedious and/or expensive)

    2. Put a load balancer in front of your cluster and configure all traffic from your clients to SF nodes to be forwarded thru that. The load balancer can be configured for Round-Robin, etc. style semantics:

    Azure Load Balancer

    Azure Traffic Manager

    Good luck!