Skip to content

HBASE-26273 Force ReadType.STREAM when the user does not explicitly s… - #3675

Closed
joshelser wants to merge 2 commits into
apache:masterfrom
joshelser:26273-snapshot-inputformat-stream
Closed

HBASE-26273 Force ReadType.STREAM when the user does not explicitly s…#3675
joshelser wants to merge 2 commits into
apache:masterfrom
joshelser:26273-snapshot-inputformat-stream

Conversation

@joshelser

Copy link
Copy Markdown
Member

…et a ReadType on the Scan for a Snapshot-based Job

HBase 2 moved over Scans to use PREAD by default instead of STREAM like
HBase 1. In the context of a MapReduce job, we can generally expect that
clients using the InputFormat (batch job) would be reading most of the
data for a job. Cater to them, but still give users who want PREAD the
ability to do so.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 6sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall4m 2smaster passed
+1 💚compile0m 50smaster passed
+1 💚checkstyle0m 20smaster passed
+1 💚spotbugs0m 46smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 45sthe patch passed
+1 💚compile0m 48sthe patch passed
+1 💚javac0m 48sthe patch passed
-0 ⚠️checkstyle0m 18shbase-mapreduce: The patch generated 6 new + 2 unchanged - 0 fixed = 8 total (was 2)
-0 ⚠️whitespace0m 0sThe patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 💚hadoopcheck18m 29sPatch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚spotbugs0m 54sthe patch passed
_ Other Tests _
+1 💚asflicense0m 14sThe patch does not generate ASF License warnings.
39m 55s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#3675
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
unameLinux b6a812e631b1 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ee632bd
Default JavaAdoptOpenJDK-1.8.0_282-b08
checkstylehttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/artifact/yetus-general-check/output/diff-checkstyle-hbase-mapreduce.txt
whitespacehttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/artifact/yetus-general-check/output/whitespace-eol.txt
Max. process+thread count96 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 5sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall4m 23smaster passed
+1 💚compile0m 26smaster passed
+1 💚shadedjars9m 5sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 19smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 5sthe patch passed
+1 💚compile0m 26sthe patch passed
+1 💚javac0m 26sthe patch passed
+1 💚shadedjars9m 5spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 17sthe patch passed
_ Other Tests _
+1 💚unit14m 34shbase-mapreduce in the patch passed.
45m 2s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#3675
Optional Testsjavac javadoc unit shadedjars compile
unameLinux d3ce3b616276 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ee632bd
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/testReport/
Max. process+thread count2775 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 6sDocker mode activated.
-0 ⚠️yetus0m 5sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall5m 6smaster passed
+1 💚compile0m 30smaster passed
+1 💚shadedjars9m 6sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 22smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 45sthe patch passed
+1 💚compile0m 30sthe patch passed
+1 💚javac0m 30sthe patch passed
+1 💚shadedjars8m 57spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 20sthe patch passed
_ Other Tests _
+1 💚unit14m 35shbase-mapreduce in the patch passed.
46m 33s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#3675
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 84296853c838 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ee632bd
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/testReport/
Max. process+thread count3357 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@taklwutaklwu 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,
[nit] if possible, can you fix the checkstyle and whitespace ?

@anoopsjohnanoopsjohn 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.

+1

/**
* The {@link ReadType} which should be set on the {@link Scan} to read the HBase Snapshot, default STREAM.
*/
public static final String SNAPSHOT_INPUTFORMAT_SCANNER_READTYPE = "hbase.TableSnapshotinputFormat.scanner.readtype";

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.

TableSnapshotinputFormat => TableSnapshotInputFormat ?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

hah! Thanks for noticing.

@Apache9Apache9 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.

I think this is an improvement so give a +1 first.

But just curious, how much we could gain from this change?

By default, we will switch to stream after reading a small amount of data, several hundreds of KBs? If we read several hundreds of MBs of data in a map reduce job, I do not think it will effect the performance too much?

@joshelser

joshelser commented Sep 13, 2021

Copy link
Copy Markdown
MemberAuthor

By default, we will switch to stream after reading a small amount of data, several hundreds of KBs? If we read several hundreds of MBs of data in a map reduce job, I do not think it will effect the performance too much?

For a standalone Java program reading a ~5G file in a single JVM (... using the mapreduce snapshot APIs), this change improved run time from 90s to 30s. In a distributed system, it only had about 15% improvement (network became the bottleneck -- that's where HBASE-26274 came into play).

[nit] if possible, can you fix the checkstyle and whitespace ?

You bet. I hadn't looked at that yet. Thanks for calling it out!

…et a ReadType on the Scan for a Snapshot-based Job
HBase 2 moved over Scans to use PREAD by default instead of STREAM like
HBase 1. In the context of a MapReduce job, we can generally expect that
clients using the InputFormat (batch job) would be reading most of the
data for a job. Cater to them, but still give users who want PREAD the
ability to do so.
@joshelser
joshelserforce-pushed the 26273-snapshot-inputformat-stream branch from 1d00647 to a808a2dCompareSeptember 13, 2021 20:38
@joshelser

Copy link
Copy Markdown
MemberAuthor

a808a2d has the fixes requested. If QA comes back happy, I'll just merge this. No need to bother y'all for a re-review. Thanks for the eyes!

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 1sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall3m 43smaster passed
+1 💚compile0m 47smaster passed
+1 💚checkstyle0m 18smaster passed
+1 💚spotbugs0m 43smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 40sthe patch passed
+1 💚compile0m 47sthe patch passed
+1 💚javac0m 47sthe patch passed
+1 💚checkstyle0m 18sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck18m 25sPatch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚spotbugs0m 55sthe patch passed
_ Other Tests _
+1 💚asflicense0m 12sThe patch does not generate ASF License warnings.
38m 27s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#3675
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
unameLinux 837b06e74a8c 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / d26bcaa
Default JavaAdoptOpenJDK-1.8.0_282-b08
Max. process+thread count95 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 26sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall4m 5smaster passed
+1 💚compile0m 27smaster passed
+1 💚shadedjars8m 12sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 22smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 43sthe patch passed
+1 💚compile0m 28sthe patch passed
+1 💚javac0m 28sthe patch passed
+1 💚shadedjars8m 11spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 19sthe patch passed
_ Other Tests _
+1 💚unit11m 20shbase-mapreduce in the patch passed.
38m 40s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#3675
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 70f7e983688f 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / d26bcaa
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/testReport/
Max. process+thread count3688 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 8sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall5m 10smaster passed
+1 💚compile0m 31smaster passed
+1 💚shadedjars9m 7sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 24smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 52sthe patch passed
+1 💚compile0m 31sthe patch passed
+1 💚javac0m 31sthe patch passed
+1 💚shadedjars9m 18spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 21sthe patch passed
_ Other Tests _
+1 💚unit14m 57shbase-mapreduce in the patch passed.
47m 17s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#3675
Optional Testsjavac javadoc unit shadedjars compile
unameLinux ed5a24165ba9 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / d26bcaa
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/testReport/
Max. process+thread count3396 (vs. ulimit of 30000)
modulesC: hbase-mapreduce U: hbase-mapreduce
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3675/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@huaxiangsun

Copy link
Copy Markdown
Contributor

By default, we will switch to stream after reading a small amount of data, several hundreds of KBs? If we read several hundreds of MBs of data in a map reduce job, I do not think it will effect the performance too much?

For a standalone Java program reading a ~5G file in a single JVM (... using the mapreduce snapshot APIs), this change improved run time from 90s to 30s. In a distributed system, it only had about 15% improvement (network became the bottleneck -- that's where HBASE-26274 came into play).

The number is impressive. For standalone Java program, is it hdfs local read with short circuit read enabled or through local tcp connection?

@joshelser

Copy link
Copy Markdown
MemberAuthor

For standalone Java program, is it hdfs local read with short circuit read enabled or through local tcp connection?

This should have been a remote TCP connection. I ran these numbers on a multiple-node cluster. It's possible that part of the data was hosted by a local Datanode, but, if memory serves, it was largely remote reads.

I have it in a private Git repository with the steps I was doing to test. I can post it if you're curious to reproduce what I did.

@joshelser

Copy link
Copy Markdown
MemberAuthor

Merged to master, branch-2, and branch-2.4.

@huaxiangsun

Copy link
Copy Markdown
Contributor

This should have been a remote TCP connection. I ran these numbers on a multiple-node cluster. It's possible that part of the data was hosted by a local Datanode, but, if memory serves, it was largely remote reads.

I have it in a private Git repository with the steps I was doing to test. I can post it if you're curious to reproduce what I did.

Thanks @joshelser. Was trying to understand how much improvement it does for regions with locality. If it is ok to share your private Git repo, I'd like to run the test on regions with 100% locality and share the numbers on the jira.

@joshelser

Copy link
Copy Markdown
MemberAuthor

@huaxiangsunhttps://github.com/joshelser/stream-repro this is the rough outline of what I was doing. Pretty straightforward (hbase pe to make data in a table, take a snapshot, and a java -cp to just read all the data as one input split).

@Apache9

Copy link
Copy Markdown
Contributor

For a standalone Java program reading a ~5G file in a single JVM (... using the mapreduce snapshot APIs), this change improved run time from 90s to 30s. In a distributed system, it only had about 15% improvement (network became the bottleneck -- that's where HBASE-26274 came into play).

It is a bit surprise to me that there could a 15% impact on performance. I was suppose that there should be little differences as we only read a very small amount of data with pread. Mind sharing more details here? Such as the HFile block size or something else? IIRC, the default config is to switch to stream after reading 4 HFile block size. And I saw you have already provide the test code, let me also take a look. Maybe we should file an issue about the performance issue with pread switching to stream.

Merged to master, branch-2, and branch-2.4.

I think we also need this on branch-2.3? It has not been EOL yet.

Thanks.

@Apache9

Copy link
Copy Markdown
Contributor

Oh, just notice that this is for reading snapshot...

Let me take a look at the input format implementation.

@joshelser

Copy link
Copy Markdown
MemberAuthor

Oh, just notice that this is for reading snapshot...

Yup! Just for reading HFiles directly from the filesystem in a local JVM.

I think we also need this on branch-2.3? It has not been EOL yet.

My bad. i'll apply there too.

@huaxiangsun

Copy link
Copy Markdown
Contributor

@huaxiangsunhttps://github.com/joshelser/stream-repro this is the rough outline of what I was doing. Pretty straightforward (hbase pe to make data in a table, take a snapshot, and a java -cp to just read all the data as one input split).

Thanks @joshelser, will report back.

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.

6 participants

@joshelser@Apache-HBase@huaxiangsun@Apache9@anoopsjohn@taklwu