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

Set limits for number of opened HTTP connections for Pulsar Admin client #22041

Open
1 of 2 tasks
lhotari opened this issue Feb 8, 2024 · 2 comments · May be fixed by #22541
Open
1 of 2 tasks

Set limits for number of opened HTTP connections for Pulsar Admin client #22041

lhotari opened this issue Feb 8, 2024 · 2 comments · May be fixed by #22541
Assignees

Comments

@lhotari
Copy link
Member

lhotari commented Feb 8, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

The Pulsar Admin client uses connection pooling (keep alive) without limiting the number of connections.
When HTTP calls get queued up on the brokers for some reason, the client will keep on opening more connections.

Solution

The AsyncHttpClient used in pulsar-admin-client should be configured to limit the number of connections.
This could happen somewhere here:

DefaultAsyncHttpClientConfig.Builder confBuilder = new DefaultAsyncHttpClientConfig.Builder();
confBuilder.setUseProxyProperties(true);
confBuilder.setFollowRedirect(true);
confBuilder.setRequestTimeout(conf.getRequestTimeoutMs());
confBuilder.setConnectTimeout(connectTimeoutMs);
confBuilder.setReadTimeout(readTimeoutMs);
confBuilder.setUserAgent(String.format("Pulsar-Java-v%s", PulsarVersion.getVersion()));
confBuilder.setRequestTimeout(requestTimeoutMs);
confBuilder.setIoThreadsCount(conf.getNumIoThreads());
confBuilder.setKeepAliveStrategy(new DefaultKeepAliveStrategy() {

setMaxConnections and setMaxConnectionsPerHost would have to be configured.
In addition, it would be useful to use setPooledConnectionIdleTimeout to set the timeout to 25 seconds so that pooled connections don't exceed timeouts in typical firewall configurations. The default of 60 seconds conflicts with many firewall idle connection defaults.

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@lhotari lhotari changed the title Add HTTP connection pooling for Pulsar Admin client Set limits for number of opened HTTP connections for Pulsar Admin client Feb 12, 2024
@lhotari
Copy link
Member Author

lhotari commented Feb 12, 2024

UPDATE: It turns out that HTTP connection pooling is already configured, but there's no limit of the number of pooled connections.

@dao-jun dao-jun pinned this issue Feb 24, 2024
@dao-jun dao-jun unpinned this issue Feb 24, 2024
@dao-jun dao-jun self-assigned this Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants