Azure / azure-cosmos-dotnet-v3

.NET SDK for Azure Cosmos DB for the core SQL API
MIT License
731 stars 488 forks source link

[Thin Client Integration] Analyze and Implement HTTP Client Sharing between Gateway and Thin Client #4579

Open kundadebdatta opened 2 months ago

kundadebdatta commented 2 months ago

HttpClient is capable of handling both Http1.1 and Http2.0 protocol. Request will decide which protocol to use (Request can opt for Http2.0 explicitly).

Therefore, ideally it should be possible to share the same client with both the (Gateway and Thin Client) store models.

FabianMeiswinkel commented 2 months ago

What does this mean? Gateway uses HTTP 1.1, Thin Client HTTP/2? Why would you want to reuse the same client - isn't like you would ever use both?

kundadebdatta commented 2 months ago

What does this mean? Gateway uses HTTP 1.1, Thin Client HTTP/2? Why would you want to reuse the same client - isn't like you would ever use both?

Agreed. Idea is to analyze if we could still leverage the CosmosHttpClient for both gateway and thin client. The CosmosHttpClient is a wrapper around the underlying HttpClient. This task is just for place holder for now to analyze if this can be done more optimally.

aavasthy commented 1 month ago

After initial investigation: HttpClient is capable of handling both Http1.1 and Http2.0 protocol. While sending the HttpRequestMessage it can specify the HttpVersion.Version20. This way same httpClient can be used for Gateway Mode or Thinclient mode.