Load balancing a service fabric StatelessService with ServicePartitionClient

旧时模样 提交于 2019-12-01 08:50:02

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!