grpcbox icon indicating copy to clipboard operation
grpcbox copied to clipboard

Add and remove dynamic endpoints

Open sevenhe1205 opened this issue 1 year ago • 4 comments

Fix functions parametes

  • Fix the value of the Name parameter passed to the subchannel in gproc_pool's disconnect_worker and remove_worker functions.

  • grpcbox_subchannel contains three properties: Channel, endpoint, and Name. During initialization, grpcbox_subchannel calls the gproc_pool:connect_worker function with Channel and Name as parameters. When terminating, grpcbox_subchannel calls the gproc_pool:disconnect_worker and gproc_pool:remove_worker functions with incorrect parameters channel and endpoint. The correct parameters to use are channel and name.

Add and remove dynamic endpoints

  • grpcbox_channel add add_endpoint and remove_endpoint functions

Add hash and direct pick strategies

  • The grpcbox_client get_channel function adds support for hash and direct strategies
  • gproc_pool:pick_worker uses the hash/direct policy. Options do not contain the Key parameter. gproc_pool:pick_worker uses the round_robin/random strategy

sevenhe1205 avatar Mar 23 '23 09:03 sevenhe1205

Thanks! Sorry I didn't get around to reviewing until now. Curious if you are using this add/remove endpoints feature in production?

tsloughter avatar May 30 '23 19:05 tsloughter

yes, Service discovery requires grpcbox to have the ability to dynamic and drop endpoints, which we are ready to use in production

sevenhe1205 avatar Jun 02 '23 17:06 sevenhe1205

@sevenhe1205 can you rebase these changes?

I'm going to make a new grpcbox release but then would like to get your changes merged in and another release made.

tsloughter avatar Nov 10 '23 21:11 tsloughter

@sevenhe1205 can you rebase these changes?

I'm going to make a new grpcbox release but then would like to get your changes merged in and another release made.

I lost my previous account, and this is a new one. I will rebase to the latest main branch. We discovered a new issue: when using the hash strategy, grpc_pool may cause the program to crash when adding and deleting workers. Therefore, we don't use the hash strategy in actual applications. Instead, we use the direct pick strategies.

heshaoqiong1205 avatar Nov 15 '23 07:11 heshaoqiong1205