Skip to content

Horizontal scaling: Distributor gRPC service + tests#669

Merged
mum4k merged 11 commits intoenvoyproxy:mainfrom
oschaaf:horizontal-scaling-distributor-service
Apr 21, 2021
Merged

Horizontal scaling: Distributor gRPC service + tests#669
mum4k merged 11 commits intoenvoyproxy:mainfrom
oschaaf:horizontal-scaling-distributor-service

Conversation

@oschaaf
Copy link
Copy Markdown
Member

@oschaaf oschaaf commented Apr 1, 2021

Part of the horizontal scaling effort: add gRPC distributor service + tests.

This new gRPC service allows delegation of load test execution initiation messages
to a set of load generator services.

Signed-off-by: Otto van der Schaaf ovanders@redhat.com

Otto van der Schaaf added 5 commits April 1, 2021 13:03
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@oschaaf oschaaf changed the title [WIP] Distributor gRPC service + tests Distributor gRPC service + tests Apr 1, 2021
@oschaaf oschaaf marked this pull request as ready for review April 1, 2021 22:35
@oschaaf oschaaf added the waiting-for-review A PR waiting for a review. label Apr 1, 2021
@oschaaf oschaaf changed the title Distributor gRPC service + tests Horizontal scaling: Distributor gRPC service + tests Apr 1, 2021
dubious90
dubious90 previously approved these changes Apr 2, 2021
Copy link
Copy Markdown
Contributor

@dubious90 dubious90 left a comment

Choose a reason for hiding this comment

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

Some nits and comments, but in general looks good. @mum4k to approve/merge.


namespace Nighthawk {

::grpc::Status NighthawkDistributorServiceImpl::validateRequest(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this be a private function in an anonymous namespace, rather than a private method object?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 6471b86


::grpc::Status NighthawkDistributorServiceImpl::validateRequest(
const ::nighthawk::DistributedRequest& request) const {
auto& validation_visitor = Envoy::ProtobufMessage::getStrictValidationVisitor();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think this would be more readable with ValidationVisitor& here instead of auto&. The type inference isn't quite obvious enough for me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 6471b86

if (status.ok()) {
std::tuple<grpc::Status, nighthawk::DistributedResponse> status_and_response =
handleRequest(request);
status = std::get<0>(status_and_response);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if we know status = ok, this line has no purpose.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well this does break the while loop when status is not OK?

const envoy::config::core::v3::Address& service,
const ::nighthawk::client::ExecutionRequest& request) const {
RELEASE_ASSERT(service_client_ != nullptr, "service_client_ != nullptr");
std::unique_ptr<nighthawk::client::NighthawkService::Stub> stub;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we instead declare this where it's used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 6471b86

const ::nighthawk::client::ExecutionRequest& request) const {
RELEASE_ASSERT(service_client_ != nullptr, "service_client_ != nullptr");
std::unique_ptr<nighthawk::client::NighthawkService::Stub> stub;
std::shared_ptr<::grpc::Channel> channel;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: remove :: at start of grpc::Channel

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed where applicable in 6471b86

repeated envoy.config.core.v3.Address services = 3 [(validate.rules).repeated .min_items = 1];
}

message DistributedResponseFragment {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add a top-level explanation of the purpose of this object?

Also, looking at the code, I think that the intention here is that one of these is associated with every nighthawk service, and essentially operates as either:

  1. We failed to connect to this service
  2. Here's the service address.

Given that, is DistributedResponseFragment a good name here? I don't love the name fragment here, because it implies to me that they are parts of a whole (often without independent meaning outside of that whole).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes this is spot on; I'll think about a better name here. Also open to suggestions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The DistributorRequest references services, so for a name how about DistributedServiceResponse or just DistributedResponse?

I think you were using Fragment to indicate that it's not the full resultset, but I don't think that's necessary here, as long as we document the intent.

(Some APIs I have used in the past have referred to this as an AsyncResponse, but I'm not sure how conventional that is).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Renamed in 5462844. I went with DistributedServiceResponse, is DistributedResponse was already used in:

message DistributedResponse {
  repeated DistributedServiceResponse service_response = 1;
}

Copy link
Copy Markdown
Collaborator

@mum4k mum4k left a comment

Choose a reason for hiding this comment

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

Just started the review and then noticed that there are still outstanding comments from @dubious90, so the code will change.

Sending what I have and will continue once the existing comments are addressed. But please let me know if I misunderstood and this is blocked on me.

@mum4k mum4k added waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. and removed waiting-for-review A PR waiting for a review. labels Apr 5, 2021
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Otto van der Schaaf added 4 commits April 6, 2021 19:16
…distributor-service

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
…distributor-service

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Apr 20, 2021
Copy link
Copy Markdown
Collaborator

@mum4k mum4k left a comment

Choose a reason for hiding this comment

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

Looks good, just one question about asserts.

@mum4k mum4k added waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. and removed waiting-for-review A PR waiting for a review. labels Apr 20, 2021
@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Apr 21, 2021
Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@mum4k mum4k merged commit fe8e3a0 into envoyproxy:main Apr 21, 2021
wjuan-AFK pushed a commit to wjuan-AFK/nighthawk that referenced this pull request May 11, 2021
Part of the horizontal scaling effort: add gRPC distributor service + tests.

This new gRPC service allows delegation of load test execution initiation messages
to a set of load generator services.

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-for-review A PR waiting for a review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants