-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-3963] Use Lock-Free Message Queue Disruptor Improving Hoodie Writing Efficiency #5416
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
Merged
nsivabalan
merged 58 commits into
apache:master
from
zhangyue19921010:hoodielockfreeinsert
Nov 3, 2022
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
527ade2
need more test and tuning
2b096e8
checked code style&& still need more java docs and more config and en…
19ce784
config and need more test
1db7936
need more consuming tuning
725f5c3
improved && add benchmark
71a9f13
adjust bulk_insert in benchmark
b5843f0
adjust bulk_insert in benchmark
4a1f01c
modify benchmark
4b94523
adjust
69904cc
tuning
204abe2
add executor bench mark
45979df
add recordsNumber to control
075cab1
code style
e87bfbc
modify benchmark
79dcebe
add bench mark result
e85c961
ready to review
b838e1f
merge from master
e00a109
code style
74068f6
code style
03b328e
code style
3778cf4
code style
8041a02
merge from master
a04be3c
merge from master
1b86864
code review
6114ee2
merge from master
67d8cd3
merge from master
b369ccb
address comments
92760db
address comments
3e44fb2
address comments
672fdc6
address comments
c0c2274
address comments
4587303
address comments
abd8b27
address comments
4ba91d4
address comments
70ca2c7
add mmore tests
447cb45
address comments
f0b7218
merge from master
eaf0ae0
address comments
270d811
address comments
0fc24d3
address comments
4797166
address comments
1fa9ac7
address comments
e230fbb
address comments
298f66d
address comments
8ded3e8
address comments
794e30b
address comments
25fcd5d
address comments
6e56bd1
address comments
d615f1f
address comments
c748320
address comments
3f3a41a
address comments
9fe6bda
merge from master
a81ffdf
merge from master
fd19907
address comments
e5c17f0
address comments
c13fc35
merge from master
d1970a3
merge from master
988e14a
address comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...lient/hudi-spark-client/src/main/java/org/apache/hudi/util/QueueBasedExecutorFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hudi.util; | ||
|
|
||
| import org.apache.hudi.common.util.queue.BoundedInMemoryExecutor; | ||
| import org.apache.hudi.common.util.queue.DisruptorExecutor; | ||
| import org.apache.hudi.common.util.queue.ExecutorType; | ||
| import org.apache.hudi.common.util.queue.HoodieExecutor; | ||
| import org.apache.hudi.common.util.queue.IteratorBasedQueueConsumer; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.exception.HoodieException; | ||
|
|
||
| import java.util.Iterator; | ||
| import java.util.function.Function; | ||
|
|
||
| public class QueueBasedExecutorFactory { | ||
|
|
||
| /** | ||
| * Create a new hoodie executor instance on demand. | ||
| */ | ||
| public static <I, O, E> HoodieExecutor create(HoodieWriteConfig hoodieConfig, Iterator<I> inputItr, IteratorBasedQueueConsumer<O, E> consumer, | ||
| Function<I, O> transformFunction, Runnable preExecuteRunnable) { | ||
| ExecutorType executorType = hoodieConfig.getExecutorType(); | ||
|
|
||
| switch (executorType) { | ||
| case BOUNDED_IN_MEMORY: | ||
| return new BoundedInMemoryExecutor<>(hoodieConfig.getWriteBufferLimitBytes(), inputItr, consumer, | ||
| transformFunction, preExecuteRunnable); | ||
| case DISRUPTOR: | ||
| return new DisruptorExecutor<>(hoodieConfig.getDisruptorWriteBufferSize(), inputItr, consumer, | ||
| transformFunction, hoodieConfig.getWriteExecutorWaitStrategy(), preExecuteRunnable); | ||
| default: | ||
| throw new HoodieException("Unsupported Executor Type " + executorType); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.