Hi,
I am trying to use bi-directional streams with JAVA. Everything works as expected in a POC of bi-di stream where I have 1 client and server which reads and writes to it.
But, it starts to break when I use the same in a mature way.
UseCase: I am trying to implement gossip using grpc in Java. Whenever any server receives a request, it gossips to the other 2 servers using grpc streams. For an instance, I have 4 servers, server1, server2, server3 and server4. All servers have 1 client configured to connect to every other server.
whenever any server receives a message, it selects the other two servers and transmits the message and the other server does the same.
Issue: As each request would be served in a new thread by grpc, I get an error
Cancelling the stream with status Status{code=INTERNAL, description=Too many) responses, cause=null}
That's bcz every request is read and write to stream isn't sync as it might not have got a response from server stream but it has written new data to it on a new request.
What can be done to overcome this problem?
Thanks for the support!!