reactor / reactor-netty

TCP/HTTP/UDP/QUIC client/server with Reactor over Netty

Home Page:https://projectreactor.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need proper documentation for Default ConnectionPool and LoopResource usage with different hosts and/or port

Akshay-Sundarraj opened this issue · comments

It is not clearly explained in document how Default Connection pool is shared among different hosts and/or port combination.

Motivation

Consider below code

HttpClient httpClient1 = HttpClient.create().host(host1).port(8000).warmup.block();  //Host1 and port 8000
HttpClient httpClient2 = HttpClient.create().host(host1).port(9000).warmup.block(); //Host1 and port 9000
HttpClient httpClient3 = HttpClient.create().host(host2).port(8000).warmup.block() //Host2 and port 8000
HttpClient httpClient4 = HttpClient.create(connectionProvider).host(host3).port(8000).warmup.block() //Host3 with connectionProvider
  1. Here LoopResources is not provided to any of the clients. Does it mean that all these clients share common loop resources?

  2. httpClient1 and httpClient2 connect to same host but different ports. In this case both of them share same ConnectionPool?

  3. httpClient1 and httpClient3 connects to different hosts. Here a separate ConnectionPool is created for each client or they share common Connection pool?

Desired solution

From the document it is difficult to infer these information. It would be good to document when and how LoopResources and ConnectionPools are shared and when it is not shared.

@Akshay-Sundarraj We have more clear documentation here in javadoc https://projectreactor.io/docs/netty/release/api/reactor/netty/resources/ConnectionProvider.Builder.html

May be we can add something similar to the reference documentation?
When referring to a remote host, it implies the combination of a hostname and its associated port number.

It is not clearly explained in document how Default Connection pool is shared among different hosts and/or port combination.

Motivation

Consider below code

HttpClient httpClient1 = HttpClient.create().host(host1).port(8000).warmup.block();  //Host1 and port 8000
HttpClient httpClient2 = HttpClient.create().host(host1).port(9000).warmup.block(); //Host1 and port 9000
HttpClient httpClient3 = HttpClient.create().host(host2).port(8000).warmup.block() //Host2 and port 8000
HttpClient httpClient4 = HttpClient.create(connectionProvider).host(host3).port(8000).warmup.block() //Host3 with connectionProvider
  1. Here LoopResources is not provided to any of the clients. Does it mean that all these clients share common loop resources?

yes

  1. httpClient1 and httpClient2 connect to same host but different ports. In this case both of them share same ConnectionPool?

no, they use different connection pools

  1. httpClient1 and httpClient3 connects to different hosts. Here a separate ConnectionPool is created for each client or they share common Connection pool?

they use different connection pools

Desired solution

From the document it is difficult to infer these information. It would be good to document when and how LoopResources and ConnectionPools are shared and when it is not shared.

Would you like to provide a PR to the documentation?