Skip to content

quic: increasing upstream packet limits - #16856

Merged
antoniovicente merged 8 commits into
envoyproxy:mainfrom
alyssawilk:read_limits
Jun 11, 2021
Merged

antoniovicente merged 8 commits into
envoyproxy:mainfrom
alyssawilk:read_limits

Conversation

@alyssawilk

Copy link
Copy Markdown
Contributor

Debugging #16853 it turned out that since we added read limits for packets, TCP downstreams were vastly out-sending UDP upstreams. Changing the upstream limit to be a factor of streams rather than flat rate.

Risk Level: low (H3 only)
Testing: new unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <[email protected]>
danzh2010
danzh2010 previously approved these changes Jun 7, 2021

@danzh2010 danzh2010 left a comment

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 fixing this! LGTM along aside a nit.

// PacketsToReadDelegate
size_t numPacketsExpectedPerEventLoop() override {
// Just as TCP does 16k per stream, do this for UDP.
return std::max<size_t>(1, GetNumActiveStreams()) * 16;

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 magic number 16 is from TCP upstream connection? Can we use a const for both plances?

Signed-off-by: Alyssa Wilk <[email protected]>
Signed-off-by: Alyssa Wilk <[email protected]>
antoniovicente
antoniovicente previously approved these changes Jun 9, 2021

@antoniovicente antoniovicente left a comment

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!

// The old socket is closed in this call.
setConnectionSocket(std::move(connection_socket));
setUpConnectionSocket();
setUpConnectionSocket(delegate_.value().get());

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.

It seems like this call to setUpConnectionSocket is setting delegate_ based on the argument pass in to the call, but we read from delegate_ when making that call.

I guess the this assumes that delegate_ is already set by a prior call to setUpConnectionSocket. Can delegate_.value() change?

One thing to consider would be to take in OptRef<PacketsToReadDelegate> delegate as an argument to setUpConnectionSocket in order to avoid the hazard of potentially reading an OptRef that is not set when making this call.


void EnvoyQuicClientConnection::setUpConnectionSocket() {
void EnvoyQuicClientConnection::setUpConnectionSocket(PacketsToReadDelegate& delegate) {
delegate_ = delegate;

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: Consider adding the following ASSERT before this line.

ASSERT(!delegate_.has_value() || &delegate == &delegate_.value().get());

// TODO(mattklein123): Emit a stat for this.
}
size_t numPacketsExpectedPerEventLoop() const override {
if (delegate_.has_value()) {

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.

In what cases is delegate_ not set? It seems like setUpConnectionSocket should be called for all connections, but possibly not early in their life cycle?

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, the connection exists before setUpConnectionSocket but AFIK it's a bug to use or migrate it before it's called.
Can't hurt to make both optref to handle such a bug without crashing though, updated.

Signed-off-by: Alyssa Wilk <[email protected]>
@antoniovicente
antoniovicente merged commit 0ab3cfe into envoyproxy:main Jun 11, 2021
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Debugging envoyproxy#16853 it turned out that since we added read limits for packets, TCP downstreams were vastly out-sending UDP upstreams. Changing the upstream limit to be a factor of streams rather than flat rate.

Signed-off-by: Alyssa Wilk <[email protected]>
@alyssawilk
alyssawilk deleted the read_limits branch August 4, 2022 00:57
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