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

[Proxy] Use shared internal and external executor for broker clients #13834

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Jan 19, 2022

Motivation

Pulsar Proxy will create a new Pulsar Client instance for each and every proxied connection.

Currently 2 threads will be created for every Pulsar Client instance for the internal/IO and external/listener executors. This causes a lot of overhead and inefficiency in the Pulsar Proxy.

In the current solution, it's already possible to share the EventLoopGroup and HashedWheelTimer instances. Support for sharing the timer was added by #9802.

A recently merged PR, #12037, added support for sharing the the internal/IO and external/listener executors in PulsarClientImpl instances. This feature has been used in this PR to share the executors across all PulsarClientImpl instances created in the Pulsar Proxy.

Modifications

  • add new configuration key brokerClientNumIOThreads which can be used to configure the number of threads for the internal/IO executor. It defaults to 2 * number of available processors.
  • create shared executors in ProxyService
  • add method for creating PulsarClientImpl to ProxyService that uses the shared executors
  • refactor ProxyConnection to use this method for PulsarClientImpl instantiation

@codelipenghui codelipenghui added this to the 2.10.0 milestone Jan 19, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

the change makes sense to me.

nice work!

do you have numbers to share in order to demonstrate the effects ?

@lhotari
Copy link
Member Author

lhotari commented Jan 19, 2022

do you have numbers to share in order to demonstrate the effects ?

@eolivelli I don't. The main impact is the fact that more threads won't be created when the number of proxy connections increase.

btw. I noticed a surprising detail of the client usage in the proxy: the client isn't used at all. I'll revisit this PR.

@lhotari
Copy link
Member Author

lhotari commented Jan 19, 2022

This PR has been replaced with an improved solution in #13836.

@lhotari lhotari closed this Jan 19, 2022
@lhotari
Copy link
Member Author

lhotari commented Jan 19, 2022

#13839 is for using shared executors for broker client / geo-replication clients

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/proxy doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants