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

Document HTTP/2 support #330

Merged
merged 2 commits into from
Jan 18, 2023
Merged

Document HTTP/2 support #330

merged 2 commits into from
Jan 18, 2023

Conversation

reta
Copy link
Collaborator

@reta reta commented Jan 16, 2023

Signed-off-by: Andriy Redko [email protected]

Description

Document HTTP/2 support (#215)

Issues Resolved

Closes #215

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Andriy Redko <[email protected]>
@@ -68,6 +68,8 @@ Transport transport = new RestClientTransport(restClient,
OpenSearchClient client = new OpenSearchClient(transport);
```

Upcoming OpenSearch `3.0.0` release brings HTTP/2 support and as such, the `RestClientTransport` would switch to HTTP/2 if available (for both HTTPS and/or HTTP protocols). The desired protocol could be forced using `RestClientBuilder.HttpClientConfigCallback`.
Copy link
Member

Choose a reason for hiding this comment

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

How can I see what protocol has been chosen?
Example of how I would switch to/from HTTP/2?

Copy link
Collaborator Author

@reta reta Jan 17, 2023

Choose a reason for hiding this comment

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

How can I see what protocol has been chosen?

Basically this could be done by:

  • inspecting the traffic
  • logging requests and responses (they contain HTTP protocol version)

I am not sure what kind of prove we could provide here.

Example of how I would switch to/from HTTP/2?

RestClientBuilder.HttpClientConfigCallback should be documented in core but I will add the configuration snippet for Apache HttpClient 5 transport.

Copy link
Member

Choose a reason for hiding this comment

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

For documentation generally I ask myself "what would I do". So if you think logging is how you'd do it, I'd show here (or somewhere in the docs) how to log the HTTP version chosen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For documentation generally I ask myself "what would I do". So if you think logging is how you'd do it, I'd show here (or somewhere in the docs) how to log the HTTP version chosen.

This is not something we should be worried about here (I think), there are few things involved on our behalf:

  • for HTTPS, we have the ALPN protocol in place
  • for HTTP, we have Upgrade in place

The OpenSearch Java client could connect to 2.x clusters fe, that would mean using HTTP/1.1 no matter what. Generally, forcing the protocol is the only reliable way (I am aware of) to make sure only HTTP/1.1 or only HTTP/2 has to be used.

To this point, we would be building features on top of HTTP/2 very soon (I believe), so the presence of HTTP/2 would be obvious.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough.

@@ -56,28 +56,46 @@ There are multiple low level transports which `OpenSearchClient` could be config
### Create a client using `RestClientTransport`

```java
Transport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
OpenSearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
Copy link
Collaborator Author

@reta reta Jan 17, 2023

Choose a reason for hiding this comment

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

Just noticed that OpenSearchClient does not accept Transport but OpenSearchTransport, fixed that in the guide

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Perfect.

@reta
Copy link
Collaborator Author

reta commented Jan 17, 2023

@VachaShah mind a review please (documentation update)? thank you!

@reta reta merged commit 04beb24 into opensearch-project:main Jan 18, 2023
@VachaShah VachaShah added the v3.0.0 Issues and PRs related to version v3.0.0 label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3.0.0 Issues and PRs related to version v3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Support HTTP/2
3 participants