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 functionality to start and shutdown grpc client workers from iovironment #78

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

raakella1
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (a51b7f7) 45.55% compared to head (9ebf4df) 45.50%.

Files Patch % Lines
src/lib/io_environment.cpp 25.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
- Coverage   45.55%   45.50%   -0.05%     
==========================================
  Files          53       53              
  Lines        3956     3958       +2     
  Branches      472      472              
==========================================
- Hits         1802     1801       -1     
- Misses       2024     2026       +2     
- Partials      130      131       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@szmyd
Copy link
Collaborator

szmyd commented Feb 12, 2024

How does this integrate with nuraft_mesg which doesn't use iomanager?

@raakella1
Copy link
Contributor Author

How does this integrate with nuraft_mesg which doesn't use iomanager?

Two ways:

  1. Do not create any worker threads in nuraft mesg. Let SM estimate the worker threads each of the component needs and create them during startup
  2. Let it create its own worker threads and we will rely on ioenvironment to shutdown all workers

@szmyd
Copy link
Collaborator

szmyd commented Feb 13, 2024

  1. Do not create any worker threads in nuraft mesg. Let SM estimate the worker threads each of the component needs and create them during startup
  2. Let it create its own worker threads and we will rely on ioenvironment to shutdown all workers

I'm trying to think of a way that nuraft_mesg can present the fact that starting and stopping the client workers is a requirement of the consumer of nuraft_mesg. I don't think it performing half the job is a great pattern (as in option 2). So maybe we can just assert in the nuraft_mesg::init code in the event that the workers haven't been started yet? That would make it clear that the responsibility is on the user of the library.

@@ -75,6 +77,11 @@ IOEnvironment& IOEnvironment::with_object_manager() {
return get_instance();
}

IOEnvironment& IOEnvironment::with_grpc_client_workers(std::string const& name, uint32_t const num_workers) {
sisl::GrpcAsyncClientWorker::create_worker(name, num_workers);
return get_instance();
Copy link
Collaborator

@szmyd szmyd Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are all these get_instance() calls? Why not just *this like normal? This is a member function, *this is the singleton...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I started returning get_instance when I first wrote this and am following it for continuity

Copy link
Collaborator

@szmyd szmyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg in general 👍

@raakella1
Copy link
Contributor Author

  1. Do not create any worker threads in nuraft mesg. Let SM estimate the worker threads each of the component needs and create them during startup
  2. Let it create its own worker threads and we will rely on ioenvironment to shutdown all workers

I'm trying to think of a way that nuraft_mesg can present the fact that starting and stopping the client workers is a requirement of the consumer of nuraft_mesg. I don't think it performing half the job is a great pattern (as in option 2). So maybe we can just assert in the nuraft_mesg::init code in the event that the workers haven't been started yet? That would make it clear that the responsibility is on the user of the library.

I like the idea of nuraft_mesg asserting and not doing the half work.

@raakella1 raakella1 merged commit 972239e into eBay:master Feb 13, 2024
12 checks passed
@raakella1 raakella1 deleted the client_workers branch February 13, 2024 19:41
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.

3 participants