Load balancing a service fabric StatelessService with ServicePartitionClient -


i'm implementing api gateway on service fabric cluster api gateway service public endpoint routes external http requests set of worker services running in cluster. inter-service communication between gateway , internal services, we're using servicepartitionclient.

i've found when using servicepartitionclient resolve service addresses , communicate stateless service, pick single instance of stateless service , communicate 1 instance every communication attempt. in case, have multiple instance of stateless service running , distribute load across them (e.g. round robin). there way using servicepartitionclient doesn't require hit namingservice service every time (which expensive our use case)?

create new instance of servicepartitionclient each request.

servicepartitionclient relatively light-weight data structure holds metadata communication channel. actual connection management, pooling, , resolved-name caching happens in layers underneath:

  • fabricclient caches resolved endpoints don't hit naming service every time ask endpoint.
  • servicepartitionresolver wraps fabricclient basic retry-loop based on common connection exceptions know about.
  • communicationclientfactorybase, if you're using it, holds on servicepartitionresolver instance , caches connections.

so make sure reusing communicationclientfactory. if using communicationclientfactorybase , aren't passing in own servicepartitionresolver, uses singleton default.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -