Hello,

I intend to use grpc between two fixed endpoints (client and server) where 
the client receives multiple requests (the client serves as a proxy) which 
in turn sends a grpc request to the server. I wanted to know of the 
following would be considered good practice:

a) For every request that comes in at the client, do the following in the 
http handler:
       a) conn := grpc.Dial(...)            // establish a grpc connection
       b) client := NewClient(conn)    // instantiate a new client
       c) client.Something(..)             // invoke the grpc method on the 
client

i.e Establish a new connection and client in handling every request

b) Establish a single grpc connection between client and server at init() 
time and then inside the handler, instantiate a new client and invoke the 
grpc method
       a) client := NewClient(conn)    // instantiate a new client
       b) client.Something(..)             // invoke the grpc method on the 
client 

c) Establish a connection and instantiate a client at init() and then in 
every handler, just invoke the grpc method.
       a) client.Something(..)

The emphasis here is on performance as I expect the the client to process a 
large volume of requests coming in. I do know that grpc underneath creates 
streams but at the end of the day a single
logical grpc connection runs on a single TCP connection (multiplexing the 
streams) on it and having just one connection for all clients might not cut 
it. Thoughts and ideas appreciated !

Thanks,
Nakul


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to