-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement][RPC] When client send request to server use a separate connection #10827
Description
Search before asking
- I had searched in the issues and found no similar feature requirement.
Description
Right now, the master and worker will send request/response to each other. And we use async mode, so once the client send a request to the server, he will not block, he just cache the request, and use a daemon thread to retry, if he doesn't receive the ack of the server in a while. Once he receive the server's ack, he will remove the related cached request.

The problem is that if the server send result to client by the old channel, the server may failed, due to the old channel closed.
e.g.
- Master dispatch task to worker, the master nettyClient port is a random port(11111), the worker nettyServer port is 1234.
- Worker will cache the channel(masterHost:11111).
- Worker will send response to master by the cached channel(masterHost:11111) and will cache the response in memory used to retry if he doesn't received the ack of his response.
If the channel masterHost: 11111 is closed, then the worker will always send response to master failed, since master doesn't has a nettyServer listen the 11111 port.
So I think when worker need to sent something to master, he need to send to the master's nettyServer, not master's nettyClient, if the channel closed, he can still create a new channel. So the worker need to know the master's nettyServer port, we need to add this in worker's config.

Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct