Load balancing a service fabric StatelessService with ServicePartitionClient

前端 未结 1 633
情深已故
情深已故 2021-01-14 09:01

I\'m implementing an API gateway on a service fabric cluster where the API gateway service is the public endpoint that routes external HTTP requests into a set of worker ser

相关标签:
1条回答
  • 2021-01-14 09:23

    Create a new instance of ServicePartitionClient for each request.

    ServicePartitionClient is a relatively light-weight data structure that just holds some metadata about a communication channel. The actual connection management, pooling, and resolved-name caching happens in the layers underneath:

    • FabricClient caches resolved endpoints so you don't hit the Naming Service every time you ask for an endpoint.
    • ServicePartitionResolver wraps FabricClient with a basic retry-loop based on common connection exceptions we know about.
    • CommunicationClientFactoryBase, if you're using it, holds on to a ServicePartitionResolver instance for you and caches connections.

    So just make sure you are reusing your CommunicationClientFactory. If you are using CommunicationClientFactoryBase and you aren't passing in your own ServicePartitionResolver, it uses the singleton by default.

    0 讨论(0)
提交回复
热议问题