Channel Management from server side

35 views
Skip to first unread message

Darshan J Gowda

unread,
Mar 27, 2024, 10:15:44 AMMar 27
to grpc.io

Understanding:

  1. Each client creates a channel to server and using that channel multiple RPCs are made.
  2. From client side channel can be closed using shutdownNow or shutdown depending on usecases.
  3. In case of multiple clients and multiple servers without any LB in between, say client 1 establishes a channel to server 1, client 1 make more than 1 RPCs that means more than one streams are created and all streams are directed to server 1.  


Question:

  1. Is there a way for server to end a channel of a particular client if it wishes using grpc-java. I came across Interceptors where client info like Ip address can be accessed by server using interceptors.. in the same way can we use client channel context and interceptors to achieve particular channel of a particular client closing in grpc-java

  2. Im aware of server.shutdown(). when its invoked on server side, it will close all the channels doesn't it ?

  3. Is the above understanding (3rd point) correct? where does sub channels come into picture among channels, RPCs(streams) here. Are subchannels and streams same ?   


Eric Anderson

unread,
Apr 3, 2024, 10:41:32 AMApr 3
to Darshan J Gowda, grpc.io
On Wed, Mar 27, 2024 at 7:15 AM Darshan J Gowda <gowda.d...@gmail.com> wrote:

  1. Is there a way for server to end a channel of a particular client if it wishes using grpc-java. I came across Interceptors where client info like Ip address can be accessed by server using interceptors.. in the same way can we use client channel context and interceptors to achieve particular channel of a particular client closing in grpc-java

The server APIs don't allow shutting down a particular connection.

  1. Im aware of server.shutdown(). when its invoked on server side, it will close all the channels doesn't it ?

It begins the shutdown process on connections. The client's channels will reconnect.

  1. Is the above understanding (3rd point) correct? where does sub channels come into picture among channels, RPCs(streams) here. Are subchannels and streams same ?

Channel: virtual connection to a service. May have 0 or many connections

Subchannel: semi-virtual connection to an address. May have 0 or many TCP connections. It will have at most one connection for new RPCs, but may have many old connections if the server sent GOAWAY but the RPCs on those connections haven't completed.

Stream: an RPC on a specific TCP connection. The RPC will fail if the TCP connection dies.
Reply all
Reply to author
Forward
0 new messages