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

[improve][broker]Only create extended partitions when updating partition number #17349

Merged
merged 4 commits into from
Sep 13, 2022

Conversation

AnonHxy
Copy link
Contributor

@AnonHxy AnonHxy commented Aug 30, 2022

Motivation

  • Only create extended partitions when update partion number. It' useful for topics having huge partitions when updating partitions
  • Also check number of new partitions must be greater than existing number of partitions

Modifications

Describe the modifications you've done.

Verifying this change

  • Make sure that the change passes the CI checks.
  • Add more test in PersistentTopicsTest#testUpdatePartitionedTopic

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@AnonHxy AnonHxy changed the title [improve][broker]Only create extended partitions when updating partition number [wip][improve][broker]Only create extended partitions when updating partition number Aug 30, 2022
@AnonHxy AnonHxy changed the title [wip][improve][broker]Only create extended partitions when updating partition number [improve][broker]Only create extended partitions when updating partition number Aug 30, 2022
@AnonHxy AnonHxy self-assigned this Aug 30, 2022
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Aug 30, 2022
@AnonHxy
Copy link
Contributor Author

AnonHxy commented Aug 31, 2022

/pulsarbot run-failure-checks

@AnonHxy
Copy link
Contributor Author

AnonHxy commented Sep 1, 2022

/pulsarbot run-failure-checks

@AnonHxy
Copy link
Contributor Author

AnonHxy commented Sep 6, 2022

@Jason918 @Technoboy- @codelipenghui PTAL~

Comment on lines 174 to 176
for (int i = oldNumPartitions; i < numPartitions; i++) {
futures.add(tryCreatePartitionAsync(i, null));
}
Copy link
Member

Choose a reason for hiding this comment

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

@mattisonchao @Technoboy- This is a good example of the challenges with asynchronous code. When using loops that trigger async calls, all operations will be started in parallel. This simply doesn't scale. Let's say that you would create 50000 partitions this way. All operations will be sent off at once.
There should be better ways to control the level of concurrency. When using threads and executors, we don't have this problem since threads will be the way to handle the level of concurrency. Obviously that has a tradeoff since threads are idling when they are waiting for responses. When using the asynchronous programming model, there should be ways to implement flow control ("back pressure") by limiting the number of operations in flight. Otherwise it will lead to a lot of requests piling up in memory when the system gets overloaded. That happens eventually if there is no way for flow control and there are a lot of operations and there are peaks in usage where the utilization of the system goes over it's throughput capacity and queues start to grow.
This particular detail was never addressed in the sync->async transformation and it will be necessary to address it to make the solution reliable.

Copy link
Member

Choose a reason for hiding this comment

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

We need to discuss this in ML. Thanks a lot for you point it out.

@AnonHxy AnonHxy force-pushed the opt_update_partition branch from d3ae3e6 to 7a99303 Compare September 7, 2022 06:36
@AnonHxy
Copy link
Contributor Author

AnonHxy commented Sep 8, 2022

/pulsarbot run-failure-checks

2 similar comments
@AnonHxy
Copy link
Contributor Author

AnonHxy commented Sep 8, 2022

/pulsarbot run-failure-checks

@AnonHxy
Copy link
Contributor Author

AnonHxy commented Sep 9, 2022

/pulsarbot run-failure-checks

@lhotari
Copy link
Member

lhotari commented Sep 9, 2022

@AnonHxy re-running failed builds won't make this PR mergeable. Please read the mailing list thread about this. https://lists.apache.org/thread/lv358906mnroq7tkk72xtsxfyjpbyvor

@AnonHxy AnonHxy closed this Sep 9, 2022
@AnonHxy AnonHxy reopened this Sep 9, 2022
@AnonHxy AnonHxy merged commit 16a39e6 into apache:master Sep 13, 2022
@AnonHxy AnonHxy added this to the 2.12.0 milestone Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants