I am in the middle of implementing GRPC on top of Service Fabric in C#. The GRPC Server requires a ServerPort (in charge of binding ssl credentials to a port) and a Service Definition (in charge of mapping requests on a path to a method delegate). I made a Communication Listener which reports the partition and replica ids along with the FQDN:port. This allows the client to correctly ensure its talking to the right partition/replica. I declared an Endpoint resource in the service mainifest and left the port blank to indicate that I want service fabric to assign a random port. My problem in local development (i haven't pushed this out to a cluster in azure yet) is that the replicas appear to die because they are assigned the same port. I should also note that I am telling the listener to listen on the secondary replicas.
My Question is:
- How does service fabric choose a port to host a service replica at?
- Is the port sharing problem for secondary replicas only a problem for local development where I am physically on the same machine? (I would assume that a replica in a real cluster will be placed on a different fault/upgrade domain)