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

Tcp: add a tcp async client #25079

Merged
merged 15 commits into from
Feb 8, 2023
Merged

Conversation

botengyao
Copy link
Member

@botengyao botengyao commented Jan 20, 2023

Signed-off-by: Boteng Yao boteng@google.com

Add a Tcp async client and factory to thread local cluster.

Commit Message:
Additional Description:
Risk Level: Low
Testing: integration & unit test
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #25079 was opened by botengyao.

see: more, trace.

Signed-off-by: Boteng Yao <boteng@google.com>
@botengyao botengyao changed the title Add a tcp async client tcp: Add a tcp async client Jan 20, 2023
@botengyao botengyao changed the title tcp: Add a tcp async client Tcp: add a tcp async client Jan 20, 2023
Signed-off-by: Boteng Yao <boteng@google.com>
@botengyao
Copy link
Member Author

/assign @yanavlasov

Thanks for the review!

For the test filter, I am not using the filter owned buffer, but directly use the underlying connection buffer to achieve the stream.

@botengyao botengyao marked this pull request as ready for review January 27, 2023 16:29
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Copy link
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

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

A couple of small nits. LGTM otherwise.

/wait

Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
@botengyao
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #25079 (comment) was created by @botengyao.

see: more, trace.

@botengyao
Copy link
Member Author

@yanavlasov PTAL, thanks!

yanavlasov
yanavlasov previously approved these changes Feb 2, 2023
@yanavlasov
Copy link
Contributor

I have pinged maintainers for non Google review

@@ -523,6 +525,8 @@ class ClusterManagerImpl : public ClusterManager,
LoadBalancerContext* context) override;
Host::CreateConnectionData tcpConn(LoadBalancerContext* context) override;
Http::AsyncClient& httpAsyncClient() override;
Tcp::AsyncTcpClientPtr tcpAsyncClient(LoadBalancerContext* context,
Copy link
Member

Choose a reason for hiding this comment

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

The AsyncTcpClient has different semantics from the HTTP async client so it might be a bit confusing. While the HTTP async client allows you to start multiple stream/request to the cluster, the AsyncTcpClient is bound to 1 connection and not reusable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, this is a factory method of the AsyncTcpClient, do you have some other suggestions?.

Copy link
Member

Choose a reason for hiding this comment

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

That depends on how this is going to be used, you might want follow the same pattern of the HTTP async client that starting multiple streams (connections in TCP).

Copy link
Member Author

@botengyao botengyao Feb 7, 2023

Choose a reason for hiding this comment

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

I see, 1 connection works for our use case right now, and I am thinking the client factory can be configurable e.g., we can add multiple connections support either in the current object or a new implementation of the interface in future. Does that SG? Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

SGTM, what I'm saying is that the name convention here confuses a bit compared to the http client above. The benefit of the http client is that you don't need to store/pass around a ClusterManager. In your use case, what if you want to retry that 1 connection?

Copy link
Member Author

@botengyao botengyao Feb 7, 2023

Choose a reason for hiding this comment

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

Thanks! We don't retry right now, I added an option to the factory, and then user can decide how the client is created & used.

Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
@botengyao
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #25079 (comment) was created by @botengyao.

see: more, trace.

Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
@lizan lizan merged commit e16acef into envoyproxy:main Feb 8, 2023
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