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

Allow config of IO and acceptor threads in proxy #14054

Merged
merged 2 commits into from
Jan 30, 2022

Conversation

addisonj
Copy link
Contributor

@addisonj addisonj commented Jan 30, 2022

Motivation

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Modifications

This adds the options to tune threads to the proxy.

It also increases the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): n
  • The public API:n
  • The schema: n
  • The default values of configurations: y
  • The wire protocol: n
  • The rest endpoints: n
  • The admin cli options: (n
  • Anything that affects deployment: n

Documentation

Javadoc is updated, but reference docs need updated as well

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)
@github-actions
Copy link

@addisonj:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@codelipenghui codelipenghui added this to the 2.10.0 milestone Jan 30, 2022
@codelipenghui codelipenghui added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages release/2.8.3 release/2.9.3 labels Jan 30, 2022
Copy link
Contributor

@MarvinCai MarvinCai left a comment

Choose a reason for hiding this comment

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

lgtm

this.workerGroup = EventLoopUtil.newEventLoopGroup(numThreads, false, workersThreadFactory);
this.acceptorGroup = EventLoopUtil.newEventLoopGroup(proxyConfig.getNumAcceptorThreads(),
false, acceptorThreadFactory);
this.workerGroup = EventLoopUtil.newEventLoopGroup(proxyConfig.getNumIOThreads(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous default numThreads is Runtime.getRuntime().availableProcessors(), but the current default numThreads is Runtime.getRuntime().availableProcessors(). It has break the default behavior. Do we need to keep the default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should move to the same default as the broker... primarily because I don't think having a single IO thread is generally something we want to do.

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@addisonj addisonj merged commit f455418 into apache:master Jan 30, 2022
lhotari pushed a commit to lhotari/pulsar that referenced this pull request Feb 9, 2022
* Allow config of IO and acceptor threads in proxy

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

* fix checkstyle

(cherry picked from commit f455418)
@lhotari lhotari added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Feb 9, 2022
lhotari pushed a commit that referenced this pull request Feb 9, 2022
* Allow config of IO and acceptor threads in proxy

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

* fix checkstyle

(cherry picked from commit f455418)
@lhotari lhotari added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Feb 9, 2022
lhotari pushed a commit to datastax/pulsar that referenced this pull request Feb 9, 2022
* Allow config of IO and acceptor threads in proxy

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

* fix checkstyle

(cherry picked from commit f455418)
(cherry picked from commit 1742df8)
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
* Allow config of IO and acceptor threads in proxy

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

* fix checkstyle
lhotari pushed a commit to datastax/pulsar that referenced this pull request Apr 20, 2022
* Allow config of IO and acceptor threads in proxy

Previously, the Pulasr Proxy did not allow configuration of the number
of IO threads and acceptor threads in the proxy.

These options can be very important to tune, as is tuneable in the
broker, so this change simply matches the brokers perspective.

Also, we increase the default number of IO threads to 2x number of
processors instead of 1x, as in a single CPU config, it still makes
sense to have 2 threads, at least for now, where some blocking
operatings can happen (such as authn/authz plugins)

* fix checkstyle

(cherry picked from commit f455418)
@Anonymitaet Anonymitaet added doc-required Your PR changes impact docs and you will update later. and removed doc-label-missing labels Apr 25, 2022
@Anonymitaet
Copy link
Member

@addisonj When submitting a PR, can you provide doc-related info (tick the box) in the PR description? So that Bot can recognize and label your PR correspondingly. Or else Bot labels your PR with doc-info-missing. Thanks.

@Anonymitaet
Copy link
Member

@momo-jun a soft reminder: here is a PR w/ doc-required label, could u pls follow up? Thanks

@Demogorgon314 Demogorgon314 deleted the proxy_thread_opts branch April 27, 2022 01:14
@momo-jun
Copy link
Contributor

@Anonymitaet, this PR requires changes to both config files and docs. @Demogorgon314 has taken care of it.

@Anonymitaet Anonymitaet added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/proxy cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-complete Your PR changes impact docs and the related docs have been already added. release/2.8.3 release/2.9.2 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants