On Friday, November 5, 2021 at 4:12:03 AM UTC-7 deepal.t...@gmail.com wrote:
> Hi, > > I have implemented Golang grpc on a blockchain for message passing. My > client side and server side code looks as follows: > > 1. Client code > /////////////////////code that establishes the grpc connection - grpc > dial////////////////////////////// > func (net DbftNetwork) EstablishConnection() { > if connected == false { > for _, p := range net.Peers { > client, err := rpc.Dial("tcp", p.Address) > This doesn't look like gRPC to me. > 2. Server code > Neither does this. > Problem - I have made the client code non-blocking by adding a go routine > for each client request. I had to do this because, in AWS multi-region the > latency was high and the number of grpc connections blocking made the CPU > stall and performance bad. After adding go routines and increasing the GOGC > value, I was able to get it to work up to 50 peers across 10 AWS regions. > But when I increase the number of peers further, the non-blocking go > routines increases further and starts stalling the CPU again. I was > wondering if there is any solution considering the above code, to make my > gRPC scalable. Any optimizations that anyone can think of. > Have you considered using a worker pool so you only have a fixed number of RPCs outstanding at any point in time? -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/553a95d6-c2ac-4ead-8998-b6521bff9ac1n%40googlegroups.com.