Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and remove dynamic endpoints #97

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sevenhe1205
Copy link

@sevenhe1205 sevenhe1205 commented Mar 23, 2023

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 sevenhe1205 force-pushed the add-and-remove-dynamic-endpoints branch 10 times, most recently from fa0df67 to 7c1ca47 Compare March 30, 2023 08:17
@sevenhe1205 sevenhe1205 force-pushed the add-and-remove-dynamic-endpoints branch from 7c1ca47 to 0f4b743 Compare April 7, 2023 07:16
@sevenhe1205 sevenhe1205 force-pushed the add-and-remove-dynamic-endpoints branch from 0f4b743 to 457924e Compare May 5, 2023 01:49
@tsloughter
Copy link
Owner

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

@sevenhe1205
Copy link
Author

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

@sevenhe1205 sevenhe1205 force-pushed the add-and-remove-dynamic-endpoints branch from 457924e to 5c041a3 Compare June 5, 2023 02:53
@tsloughter
Copy link
Owner

@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.

@heshaoqiong1205
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants