Re: [PR] [improve][client] Add connectionsPerHost and connectionMaxIdleSeconds to PulsarAdminBuilder [pulsar]

2024-04-22 Thread via GitHub


lhotari commented on code in PR #22541:
URL: https://github.com/apache/pulsar/pull/22541#discussion_r1574216061


##
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PulsarAdminBuilderImpl.java:
##
@@ -47,6 +47,7 @@ public PulsarAdmin build() throws PulsarClientException {
 
 public PulsarAdminBuilderImpl() {
 this.conf = new ClientConfigurationData();
+this.conf.setConnectionsPerBroker(16);

Review Comment:
   > Couldn't the default be part of `ClientConfigurationData` constructor?
   
   Not really. ClientConfigurationData is designed for PulsarClient, but it's 
also used in PulsarAdmin client. The current PulsarAdminBuilderImpl is a bit of 
a hack around ClientConfigurationData.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [improve][client] Add connectionsPerHost and connectionMaxIdleSeconds to PulsarAdminBuilder [pulsar]

2024-04-19 Thread via GitHub


merlimat commented on code in PR #22541:
URL: https://github.com/apache/pulsar/pull/22541#discussion_r1573069445


##
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PulsarAdminBuilderImpl.java:
##
@@ -47,6 +47,7 @@ public PulsarAdmin build() throws PulsarClientException {
 
 public PulsarAdminBuilderImpl() {
 this.conf = new ClientConfigurationData();
+this.conf.setConnectionsPerBroker(16);

Review Comment:
   Couldn't the default be part of `ClientConfigurationData` constructor?



##
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/PulsarAdminBuilder.java:
##
@@ -336,4 +336,30 @@ PulsarAdminBuilder authentication(String 
authPluginClassName, Map
+ * By default, the connection pool maintains up to 16 connections to a 
single host. This method allows you to
+ * modify this default behavior and limit the number of connections.
+ * 
+ * This setting can be useful in scenarios where you want to limit the 
resources used by the client library,
+ * or control the level of parallelism for operations so that a single 
client does not overwhelm
+ * the Pulsar cluster with too many concurrent connections.
+ *
+ * @param connectionsPerHost the maximum number of connections to 
establish per host. Set to <= 0 to disable
+ * the limit.
+ * @return the PulsarAdminBuilder instance, allowing for method chaining
+ */
+PulsarAdminBuilder connectionsPerHost(int connectionsPerHost);

Review Comment:
   maybe `maxConnectionsPerHost()` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org