Skip to content

HBASE-28836 Parallelize the file archival to improve the split times - #6243

Closed
mnpoonia wants to merge 4 commits into
apache:masterfrom
mnpoonia:master
Closed

HBASE-28836 Parallelize the file archival to improve the split times #6243
mnpoonia wants to merge 4 commits into
apache:masterfrom
mnpoonia:master

Conversation

@mnpoonia

@mnpooniamnpoonia commented Sep 13, 2024

Copy link
Copy Markdown
Contributor

No description provided.

@mnpoonia

Copy link
Copy Markdown
ContributorAuthor

@apurtell FYI

@Umeshkumar9414Umeshkumar9414 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

List<File> failures = new ArrayList<>();
String startTime = Long.toString(start);
for (File file : toArchive) {
toArchive.parallelStream().forEach(file -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to check the difference between the parallelStream() and stream().parallel(). Java doc say that for parallelStream "It is allowable for this method to return a sequential stream."

List<File> failures = new ArrayList<>();
String startTime = Long.toString(start);
for (File file : toArchive) {
toArchive.parallelStream().forEach(file -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also if toArchive is small, there are chances that making it parallel can take more time than doing the same sequentially.

@mnpooniamnpooniaSep 13, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This wouldn't be the case as it is an IO operation (and diff wouldn't be noticable). So parallelizing it would improve it over what we already have. In pricinple i agree about what you are saying

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought parallelStream (and its underlying ForkJoinPool) is not really for I/O blocking operations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, that's another point to consider

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 41sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall3m 6smaster passed
+1 💚compile3m 1smaster passed
+1 💚checkstyle0m 38smaster passed
+1 💚spotbugs1m 34smaster passed
+1 💚spotless0m 45sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall2m 53sthe patch passed
+1 💚compile3m 1sthe patch passed
+1 💚javac3m 1sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 37sthe patch passed
+1 💚spotbugs1m 42sthe patch passed
+1 💚hadoopcheck10m 37sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 43spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 12sThe patch does not generate ASF License warnings.
36m 9s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6243
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 0fe806a19d7d 5.4.0-186-generic #206-Ubuntu SMP Fri Apr 26 12:31:10 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / be6e570
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/1/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 26sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 4smaster passed
+1 💚compile0m 54smaster passed
+1 💚javadoc0m 27smaster passed
+1 💚shadedjars5m 32sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall2m 53sthe patch passed
+1 💚compile0m 54sthe patch passed
+1 💚javac0m 54sthe patch passed
+1 💚javadoc0m 25sthe patch passed
+1 💚shadedjars5m 31spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌unit208m 40s/patch-unit-hbase-server.txthbase-server in the patch failed.
232m 44s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/1/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6243
Optional Testsjavac javadoc unit compile shadedjars
unameLinux ff7d3094ff74 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / be6e570
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/1/testReport/
Max. process+thread count5083 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/1/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@mnpoonia

mnpoonia commented Sep 13, 2024

Copy link
Copy Markdown
ContributorAuthor

Unit test failures seems to be unrelated.


ERROR] Failures: [ERROR] TestSecureIPC>AbstractTestSecureIPC.testRpcServerDisallowFallbackToSimpleAuth:279 Expected: (an instance of java.io.EOFException or an instance of org.apache.hadoop.hbase.exceptions.ConnectionClosedException)
but: was <java.net.SocketException: Connection reset>
[ERROR] Errors: [ERROR] TestSecureIPC.setUp:74->AbstractTestSecureIPC.initKDCAndConf:99 » Krb Failed to load or create keytab /home/jenkins/jenkins-home/workspace/Base-PreCommit-GitHub-PR_PR-6243/yetus-jdk17-hadoop3-check/src/hbase-server/target/test-data/2cbc9b35-01c7-7660-1fc6-e1d4722aafe2/keytab
[INFO] [ERROR] Tests run: 7004, Failures: 1, Errors: 1, Skipped: 35
[INFO]

@virajjasanivirajjasani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While it is good to have parallel stream, it still relies on CPU cores to distribute the task for the underlying fork-join pool right? Why not create our own thread-pool to execute the tasks to achieve deterministic behavior independent of CPU cores?

List<File> failures = new ArrayList<>();
String startTime = Long.toString(start);
for (File file : toArchive) {
toArchive.parallelStream().forEach(file -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought parallelStream (and its underlying ForkJoinPool) is not really for I/O blocking operations.

List<File> failures = new ArrayList<>();
String startTime = Long.toString(start);
for (File file : toArchive) {
toArchive.parallelStream().forEach(file -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is the access to ArrayList failures thread safe?

@d-c-manningd-c-manning left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is HFileArchiver in the path for Split? It should be background.

@virajjasani

virajjasani commented Sep 14, 2024

Copy link
Copy Markdown
Contributor

Since both region close as well as CompactedHFilesDischarger chore performs archival, we can keep Jira/PR title generic i.e. "Parallelize the file archival for performance improvement" or "Parallelize the file archival" (by removing both "split times" and "object stores" from it because the change is generic and not specific to object stores as per the PR change, and Jira description is good to explain why we need this specifically for S3).

@mnpooniamnpoonia changed the title HBASE-28836 Parallize the file archival to improve the split times in…HBASE-28836 Parallize the file archival to improve the split times Sep 16, 2024
List<File> failures = new ArrayList<>();
String startTime = Long.toString(start);
for (File file : toArchive) {
toArchive.parallelStream().forEach(file -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are IO operations in the code block so usually it is not safe to use parallelStream...

AFAIK parallelStream will make use of a common thread pool(ForkJoinPool.commonPool IIRC) which could be used by lots of other operations in java, so it is easy to introduce strange dead locks.

If we want to do it in parallel, we'd better introduce our own thread pool.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec4m 2sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall3m 8smaster passed
+1 💚compile3m 1smaster passed
+1 💚checkstyle0m 35smaster passed
+1 💚spotbugs1m 33smaster passed
+1 💚spotless0m 45sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall2m 53sthe patch passed
+1 💚compile2m 56sthe patch passed
+1 💚javac2m 56sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 37sthe patch passed
+1 💚spotbugs1m 40sthe patch passed
+1 💚hadoopcheck10m 44sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
-1 ❌spotless0m 38spatch has 44 errors when running spotless:check, run spotless:apply to fix.
_ Other Tests _
+1 💚asflicense0m 12sThe patch does not generate ASF License warnings.
39m 24s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6243
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux a485f83be116 5.4.0-195-generic #215-Ubuntu SMP Fri Aug 2 18:28:05 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / b33878a
Default JavaEclipse Adoptium-17.0.11+9
spotlesshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/artifact/yetus-general-check/output/patch-spotless.txt
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec2m 31sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 51smaster passed
+1 💚compile0m 54smaster passed
+1 💚javadoc0m 26smaster passed
+1 💚shadedjars5m 32sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall2m 52sthe patch passed
+1 💚compile0m 55sthe patch passed
+1 💚javac0m 55sthe patch passed
+1 💚javadoc0m 26sthe patch passed
+1 💚shadedjars5m 29spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit210m 45shbase-server in the patch passed.
236m 54s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6243
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 78c03a61ff1a 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / b33878a
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/testReport/
Max. process+thread count5088 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/2/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@NihalJain

Copy link
Copy Markdown
Contributor

nit: Parallize -> Parallelize

@mnpooniamnpoonia changed the title HBASE-28836 Parallize the file archival to improve the split times HBASE-28836 Parallelize the file archival to improve the split times Sep 17, 2024
@mnpoonia

Copy link
Copy Markdown
ContributorAuthor

I have added the logic for executor service doing the cleanup. I am still looking at executor service creation and config part. Basically trying to figure out the right config. Currently i am thinking of using hbase.regionserver.region.split.threads.max config for number of executor threads.
@d-c-manning@virajjasani@Apache9 FYI

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 37sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall2m 55smaster passed
+1 💚compile2m 58smaster passed
+1 💚checkstyle0m 37smaster passed
+1 💚spotbugs1m 32smaster passed
+1 💚spotless0m 44sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall2m 55sthe patch passed
+1 💚compile3m 6sthe patch passed
+1 💚javac3m 6sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 37sthe patch passed
+1 💚spotbugs1m 39sthe patch passed
+1 💚hadoopcheck10m 23sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 44spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 10sThe patch does not generate ASF License warnings.
35m 34s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6243
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux ab8328bd1e96 5.4.0-195-generic #215-Ubuntu SMP Fri Aug 2 18:28:05 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1e21b43
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/3/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 27sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 5smaster passed
+1 💚compile0m 54smaster passed
+1 💚javadoc0m 27smaster passed
+1 💚shadedjars5m 29sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall2m 53sthe patch passed
+1 💚compile0m 56sthe patch passed
+1 💚javac0m 56sthe patch passed
+1 💚javadoc0m 26sthe patch passed
+1 💚shadedjars5m 30spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit209m 42shbase-server in the patch passed.
233m 58s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6243
Optional Testsjavac javadoc unit compile shadedjars
unameLinux e08784b4e144 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1e21b43
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/3/testReport/
Max. process+thread count5077 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6243/3/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@mnpoonia

Copy link
Copy Markdown
ContributorAuthor

Created a new PR because of messed up local git.
#6483

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@mnpoonia@Apache-HBase@virajjasani@NihalJain@apurtell@Apache9@Umeshkumar9414@d-c-manning