Skip to content

[WIP] Fixes #2943 - implements one xDS connection per resource type and config server #4823

Closed
dmitri-d wants to merge 7 commits intoenvoyproxy:masterfrom
dmitri-d:2943-optimize-eds
Closed

[WIP] Fixes #2943 - implements one xDS connection per resource type and config server #4823
dmitri-d wants to merge 7 commits intoenvoyproxy:masterfrom
dmitri-d:2943-optimize-eds

Conversation

@dmitri-d
Copy link
Copy Markdown
Contributor

  • rebased
  • GrpcMuxFactory.getOrCreateMux uses type_url to differentiate between resources

@htuch: dmitri-d@aefebec#diff-c0c965f7fd55bbb5ef55f13321e43270R344 is this what you had in mind when you commented on insufficiency of cluster_name/target_uri for map keys?

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Yep, @dmitri-d this is on the right track. See my comment.

public:
virtual ~GrpcMuxFactory() {}

virtual Config::GrpcMux*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add Doxygen comments, thanks.

std::string mux_key; // config_source_name + type_url
switch(config_source.grpc_services(0).target_specifier_case()) {
case envoy::api::v2::core::GrpcService::kEnvoyGrpc: {
mux_key = config_source.grpc_services(0).envoy_grpc().cluster_name() + type_url;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we should literally require proto equality here. The reasoning here is that there are configuration options, e.g. timeouts, initial metadata, which should ideally be consistent.

@dmitri-d
Copy link
Copy Markdown
Contributor Author

  • GrpcMux now starts a new connection when a new subscription is created
  • Added Doxygen comments in include/envoy/upstream/grpc_mux_factory.h
  • GrpcService_EnvoyGrpc/GrpcService_GoogleGrpc is now used as keys for GrpcMuxes in GrpcMuxFactoryImpl

Copy link
Copy Markdown
Member

@htuch htuch 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. Needs tests and release notes, but on the right track.

* @param local_info LocalInfo::LocalInfo local info.
* @param async_client Grpc::AsyncClientPtr async client to use for the grpc connection
* @param dispatcher event dispatcher.
* @param _method fully qualified name of v2 gRPC API bidi streaming method (as per protobuf
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: service_method

virtual ~GrpcMuxFactory() {}

/**
* Returns an existing or creates a new GrpcMux.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain the criteria by which we get existing vs. new?

Stats::Scope& scope, const std::string type_url) override {

uint64_t proto_hash; // config_source_name + type_url
switch(config_source.grpc_services(0).target_specifier_case()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would just write proto_hash = MessageUtil::hash(config_source.grpc_services(0)

NOT_REACHED_GCOVR_EXCL_LINE;
}

const uint64_t mux_key = proto_hash + XXH64(type_url.c_str(), type_url.length() + 1, 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe ^ instead of +, or even better, use proto_hash as the seed.

}

private:
std::unordered_map<uint64_t, Config::GrpcMux*> muxes_;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GrpcMux should be a unique_ptr here to get cleanup via RAII.

@dmitri-d
Copy link
Copy Markdown
Contributor Author

  • Updated Doxygen docs for GrpcMuxFactory
  • GrpcMuxFactoryImpl now uses unique_ptr internally
  • Modified hash key generation to use GrpcService and use that as a seed in a call to XXH64.

Copy link
Copy Markdown
Member

@htuch htuch 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 needs tests now.

@stale
Copy link
Copy Markdown

stale bot commented Nov 2, 2018

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Nov 2, 2018
@stale
Copy link
Copy Markdown

stale bot commented Nov 9, 2018

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale stalebot believes this issue/PR has not been touched recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants