-
Notifications
You must be signed in to change notification settings - Fork 312
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
perf: enhance the loading process of replicas particularly when a significant number of replicas are spread across multiple disks #2078
Merged
Conversation
This file contains 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
acelyc111
reviewed
Jul 30, 2024
acelyc111
reviewed
Jul 30, 2024
acelyc111
reviewed
Jul 30, 2024
empiredan
force-pushed
the
optimize-load-replica
branch
from
August 23, 2024 09:32
80f2a64
to
029319f
Compare
empiredan
force-pushed
the
optimize-load-replica
branch
from
September 18, 2024 07:20
aaa9c43
to
0b047f9
Compare
empiredan
force-pushed
the
optimize-load-replica
branch
2 times, most recently
from
September 23, 2024 10:49
9bffedc
to
9a8e525
Compare
empiredan
force-pushed
the
optimize-load-replica
branch
from
September 29, 2024 09:52
6e246bb
to
018d3b4
Compare
empiredan
force-pushed
the
optimize-load-replica
branch
from
December 16, 2024 06:24
018d3b4
to
1d8a460
Compare
…eplicas dynamically
acelyc111
approved these changes
Dec 25, 2024
foreverneverer
approved these changes
Dec 26, 2024
empiredan
added
type/config-change
Added or modified configuration that should be noted on release note of new version.
type/performance
performance optimization or tunning
labels
Dec 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cpp
scripts
type/config-change
Added or modified configuration that should be noted on release note of new version.
type/performance
performance optimization or tunning
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.
Immediately after the replica server is started, all of the replicas under the data
directory would be loaded. Currently, a loading task is launched for each replica
directory. The tasks for loading replica directories are pushed into a partitioned
thread pool (namely
THREAD_POOL_REPLICATION
) disk by disk: only after allof the replica directories on the current disk have been pushed into the thread
pool would the process move on to the next disk. Since the thread pool is partitioned
while the hash for each task is the total number of the tasks that have been in the
pool before this task is added, all of the replica directories on one disk would be
executed concurrently. This would lead to two problems once there are a great number
of replica directories on each disk:
%util
might become 100%;one disk is keeping busy while others are idle.
The replica server seems getting stuck in loading replicas after it is started. This is
unacceptable and should be changed.
The improved version allows the replica directories on different disks to be loaded
simultaneously: every disk would be busy loading replicas. Also, loading tasks would
be pushed into a non-partitioned thread pool (i.e.
THREAD_POOL_LOCAL_APP
)instead of the partitioned, making tasks across multiple threads auto-balanced to
prevent some threads from being starved while others are stuffed.
And new parameter is added to restrict the max number of replicas allowed to be loaded
simultaneously for each disk, in case that I/O usage for each disk becomes saturated.
Another parameter is added to ensure that the main thread waiting all loading tasks to
finished would not be blocked on one task too long while the number of tasks for loading
replica directories simultaneously on a single disk has reached its limit.
Parameters are added as follows: