Skip to content

grid: the basic structure of the connectivity grid#15656

Merged
alyssawilk merged 12 commits intoenvoyproxy:mainfrom
alyssawilk:http3
Mar 30, 2021
Merged

grid: the basic structure of the connectivity grid#15656
alyssawilk merged 12 commits intoenvoyproxy:mainfrom
alyssawilk:http3

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

Naive connectivity grid, which works for TCP/UDP and only does serial connections.

I figured there's enough code to start with, that all the fun stuff can come in follow-ups.

Risk Level: n/a (unused code)
Testing: new unit tests
Docs Changes: n/a
Release Notes: n/a
Part of #15649

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@ggreenway
Copy link
Copy Markdown
Member

Quick driveby comment: I'm not a fan of "grid" for the name. Without reading the linked issue, I had no idea what that meant. I'd prefer something like "probe" or "autodetect" or something.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Contributor Author

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Thanks for the quick review!
I'm still trying to sort out that test error - doesn't reproduce locally with -c opt, but I'm 95% sure it's just a bug in the real grid test, so I think fine for another code pass.

std::list<ConnectionPool::InstancePtr> pools_;
// True iff under the stack of the destructor, to avoid calling drain
// callbacks on deletion.
bool destroying_{};
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I prefer that syntax but I tend to get nits from other reviewers to use {} so I think it's general Envoy style.

@alyssawilk
Copy link
Copy Markdown
Contributor Author

Quick driveby comment: I'm not a fan of "grid" for the name. Without reading the linked issue, I had no idea what that meant. I'd prefer something like "probe" or "autodetect" or something.

probe_pool or autodetect pool don't really work for me. David, any thoughts on naming?

PoolIterator pool_it_;
// The handle to cancel the request to the current pool.
// This is owned by the pool which created it.
Cancellable* cancellable_;
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.

Since this can't be null, should it be a reference instead (apologies if this is wrong, it's a part of the Envoy style guide that I'm not used to)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, Envoy is generally pretty anti-pointer, but this is set by one of the rare Envoy functions which returns a pointer, and we change what it points to, so I'm inclined to leave it as is. swapping the thing a reference refers to just feels wrong. happy to be overriden by Matt here.

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.

Thanks for the explanation, happy to defer to the two of you here :)

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.

Optimally this would change to an RAII thing, but this is fine!

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@DavidSchinazi
Copy link
Copy Markdown
Contributor

We could always call it the EyeballHappinessGenerator but that's somewhat of a mouthful :P
I don't have any good ideas for names right now but I'll keep thinking about it

DavidSchinazi
DavidSchinazi previously approved these changes Mar 25, 2021
Copy link
Copy Markdown
Contributor

@DavidSchinazi DavidSchinazi left a comment

Choose a reason for hiding this comment

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

Thanks for the discussion!

// If this point is reached, all pools have been tried. Pass the pool failure up to the
// original caller.
ConnectionPool::Callbacks& callbacks = inner_callbacks_;
grid_.wrapped_callbacks_.erase(index_); // Functionally "delete this"
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: dot after comment (same below)

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
DavidSchinazi
DavidSchinazi previously approved these changes Mar 29, 2021
Copy link
Copy Markdown
Contributor

@DavidSchinazi DavidSchinazi left a comment

Choose a reason for hiding this comment

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

I like the list approach!

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

First pass reviewed, and I've merged past the mega quic merge, @mattklein123 you up for a pass?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks this LGTM at a high level to ship and iterate.

PoolIterator pool_it_;
// The handle to cancel the request to the current pool.
// This is owned by the pool which created it.
Cancellable* cancellable_;
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.

Optimally this would change to an RAII thing, but this is fine!

Comment on lines +130 to +133
// TODO(#15649) track pools with successful connections: don't always start at
// the front of the list.
auto wrapped_callback =
std::make_unique<WrapperCallbacks>(*this, decoder, pools_.begin(), callbacks);
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.

This is where we would race, right? Just want to check my understanding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mostly. Right now wrapped callbacks only allows one connection attempt at a time. I've got a follow-up which splits some of the state into PerConnectAttempt and kicks off parallel attempts based on a timer.

@alyssawilk alyssawilk merged commit 918a232 into envoyproxy:main Mar 30, 2021
@alyssawilk alyssawilk deleted the http3 branch July 15, 2021 19:32
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