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

HADOOP-17272. ABFS Streams to support IOStatistics API #2353

Closed
wants to merge 16 commits into from

Conversation

mehakmeet
Copy link
Contributor

Tested using: mvn -T 1C -Dparallel-tests=abfs clean verify
Region: East US

[INFO] Results:
[INFO]
[INFO] Tests run: 87, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 458, Failures: 0, Errors: 0, Skipped: 71
[INFO] Results:
[INFO]
[WARNING] Tests run: 206, Failures: 0, Errors: 0, Skipped: 29

Change-Id: Ic0cdd0c3707066fff8b21f9cca6e7265a547267c
This is to allow hadoop-aws to compile without needing to move to the
moved interfaces; it will also allow anything external which used those
methods (unlikely) to keep working.

Also: throw synchronized at methods to get findbugs to STFU.

Tempting just to turn it off on the basis that it is overkill, but it could
maybe be correct.

Making all of MeanStatistics synchronized is irritating, as it will hurt
performance on what should be a lightweight class. But it is needed to
ensure samples and sum are consistently set.

Change-Id: I4c3e2726e1e97d705c55dbb43a507ea4d0e81e28
Change-Id: I5f64704a82a196fd8ff66cbde10d4970722e1fd7
Change-Id: I3e9bb83bc32eddc5c7d84c1df7be77cea3e60f5d
- failures are registered and reported differently
- helper in statistics.impl to wrap functions and callable with handling for this

Move BufferedIOStatistics streams from impl to fs.statistics, so its declared
OK for others to use

counter increment to ignore negative values; returns existing value.
successful increment returns the latest value, as documented.

Tests for the counter and gauge behaviour

Change-Id: Ic851240ebe94033bf93e0a11abefb7adda534191
@mehakmeet
Copy link
Contributor Author

AbfsOutputStream and AbfsInputStream to support IOStatistics(#2323).

AbfsOutputStream is the first commit and AbfsInputStream integration with IOStatistics would be a different commit.

on hasNext/Next, close() is called, so as to cleanup any open state/handles
etc. Avoids having to tell developers downstream to look for an iterator
being closeable, and call it if so.

+ minor improvements in iterator test suite
+ fix typo found by Mehakmeet

Change-Id: Ibd103941278b8c0bc6c93a09ea469be4c60a58b1
@steveloughran steveloughran added the fs/azure changes related to azure; submitter must declare test endpoint label Sep 30, 2020
Copy link
Contributor

@steveloughran steveloughran left a comment

Choose a reason for hiding this comment

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

Nice to see how you use the API, good to get the feedback

both the input and output streams need to declare implements IOStatisticsSource, and getIOStatistics to return their value.

@mehakmeet
Copy link
Contributor Author

Have to force push since am rebasing Steve's branch on my commits. Also, Don't know why Yetus isn't running.

+ add class which can be used to store duration results, primarily for
testing. Made public for others to play with too

Change-Id: I0a7f274f5a2a180e1800102be177b308050725c0
@steveloughran
Copy link
Contributor

yetus is sort of running; latest build reports differently. I think it's updating the Hadoop JIRA. If you look at the "all checks have failed" bit below, you get the logs and can click through to the test results instead. Nice integration and avoids PRs filling up with Yetus messages. But: checkstyle and deprecation messages will also trigger the failure notification, so the reporting is overreacting.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 48s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 2s No case conflicting files found.
+0 🆗 markdownlint 0m 0s markdownlint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 0m 0s test4tests The patch appears to include 14 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 5m 51s Maven dependency ordering for branch
+1 💚 mvninstall 32m 53s trunk passed
+1 💚 compile 28m 39s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 compile 23m 46s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 checkstyle 3m 21s trunk passed
+1 💚 mvnsite 2m 47s trunk passed
+1 💚 shadedclient 22m 55s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 1m 30s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 34s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+0 🆗 spotbugs 1m 22s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 4m 7s trunk passed
-0 ⚠️ patch 1m 48s Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 33s Maven dependency ordering for patch
+1 💚 mvninstall 1m 48s the patch passed
+1 💚 compile 26m 29s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
-1 ❌ javac 26m 29s /diff-compile-javac-root-jdkUbuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1.txt root-jdkUbuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 generated 20 new + 2050 unchanged - 0 fixed = 2070 total (was 2050)
+1 💚 compile 22m 28s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
-1 ❌ javac 22m 28s /diff-compile-javac-root-jdkPrivateBuild-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01.txt root-jdkPrivateBuild-1.8.0_265-8u265-b01-0ubuntu218.04-b01 with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu218.04-b01 generated 20 new + 1945 unchanged - 0 fixed = 1965 total (was 1945)
-0 ⚠️ checkstyle 3m 14s /diff-checkstyle-root.txt root: The patch generated 10 new + 141 unchanged - 4 fixed = 151 total (was 145)
+1 💚 mvnsite 2m 45s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 16m 39s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 1m 36s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 36s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 findbugs 4m 50s the patch passed
_ Other Tests _
+1 💚 unit 11m 53s hadoop-common in the patch passed.
+1 💚 unit 2m 5s hadoop-azure in the patch passed.
+1 💚 asflicense 1m 4s The patch does not generate ASF License warnings.
228m 9s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/3/artifact/out/Dockerfile
GITHUB PR #2353
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle markdownlint
uname Linux de22054346fd 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 tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4347a5c
Default Java Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/3/testReport/
Max. process+thread count 1376 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-common hadoop-tools/hadoop-azure U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/3/console
versions git=2.17.1 maven=3.6.0 findbugs=4.0.6
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@steveloughran steveloughran left a comment

Choose a reason for hiding this comment

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

LGTM;

  • I'm going to tweak trackDuration to make it easier for you
  • that's ~it for this patch

we do need to get that main IOStats one in. Add your comments there as someone who has been using it...

@@ -160,7 +159,7 @@ public void testSeekStatistics() throws IOException {
assertEquals("Mismatch in forwardSeekOps value", OPERATIONS,
stats.getForwardSeekOperations());
assertEquals("Mismatch in bytesBackwardsOnSeek value",
-1 * OPERATIONS * ONE_MB, stats.getBytesBackwardsOnSeek());
OPERATIONS * ONE_MB, stats.getNegativeBytesBackwardsOnSeek());
Copy link
Contributor

Choose a reason for hiding this comment

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

why the name change? What does this statistic mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bytesBackwardsOnSeek had negative increments and thus had a negative value but, since we have a restriction that counters can't increment negative values, I thought to have a negative of bytesBackwardsOnSeek counter so that we can have a counter to represent this value just in positive. Looks confusing I guess, should've come up with better naming :)

* move the methods in fs.impl.FutureIOSupport which turn out to be needed
  when working with the async code to the public utils.functional package
* duration tracking invocation in IOStatisticsBinding tuning based on the
  ABFS coding experience.

Change-Id: Ide9467fa67a8a5d3d8daec94a7a39ff87f106a47
Fix checkstyle in RemoteIOException
unwrapping of exception looks for Error and rethrows

Change-Id: I673b1e487cae2ec3204ce6ba1103cdae14cfe48c
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 30s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 2s No case conflicting files found.
+0 🆗 markdownlint 0m 0s markdownlint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 0m 0s test4tests The patch appears to include 14 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 6s Maven dependency ordering for branch
+1 💚 mvninstall 24m 6s trunk passed
+1 💚 compile 19m 40s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 compile 17m 0s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 checkstyle 2m 48s trunk passed
+1 💚 mvnsite 2m 22s trunk passed
+1 💚 shadedclient 19m 50s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 1m 21s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 12s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+0 🆗 spotbugs 1m 8s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 3m 27s trunk passed
-0 ⚠️ patch 1m 29s Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 27s Maven dependency ordering for patch
+1 💚 mvninstall 1m 20s the patch passed
+1 💚 compile 18m 52s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
-1 ❌ javac 18m 52s /diff-compile-javac-root-jdkUbuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1.txt root-jdkUbuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 generated 20 new + 2050 unchanged - 0 fixed = 2070 total (was 2050)
+1 💚 compile 16m 54s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
-1 ❌ javac 16m 54s /diff-compile-javac-root-jdkPrivateBuild-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01.txt root-jdkPrivateBuild-1.8.0_265-8u265-b01-0ubuntu218.04-b01 with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu218.04-b01 generated 20 new + 1945 unchanged - 0 fixed = 1965 total (was 1945)
-0 ⚠️ checkstyle 2m 47s /diff-checkstyle-root.txt root: The patch generated 7 new + 141 unchanged - 4 fixed = 148 total (was 145)
+1 💚 mvnsite 2m 21s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 14m 23s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 1m 11s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 9s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 findbugs 3m 38s the patch passed
_ Other Tests _
+1 💚 unit 9m 54s hadoop-common in the patch passed.
+1 💚 unit 1m 44s hadoop-azure in the patch passed.
+1 💚 asflicense 0m 50s The patch does not generate ASF License warnings.
176m 15s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/4/artifact/out/Dockerfile
GITHUB PR #2353
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle markdownlint
uname Linux 0827a92c3982 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 tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 52db86b
Default Java Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/4/testReport/
Max. process+thread count 1394 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-common hadoop-tools/hadoop-azure U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/4/console
versions git=2.17.1 maven=3.6.0 findbugs=4.0.6
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

* the trackDuration(DurationTrackerFactory,...) methods support null factory
  and switch to a stub tracker
* there's an overloaded logIOStatisticsAtDebug() method to use the
  IOStatisticsLogging own logger

Change-Id: Ie786dc7aa8920a3fc8b22b55916f4b811810dab3
* PairedDurationTrackerFactory allows listing code to update both FS and instance
  level stats.
* test assertions to become verifyStatistic* assertStatistic* to make clear
  these are statistic assertions; also helps code completion
* stream_read_unbuffered stream key

Change-Id: I25272fffeb3e66b5cec90ae6c6af74808c139b26
Copy link
Contributor

@steveloughran steveloughran left a comment

Choose a reason for hiding this comment

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

All your additions LGTM; note the comment about grabbing the AtomicLong reference for frequently-updated counters; I will do that in the the S3A input stream too

"Total number of times a write operation is throttled."),

//OutputStream statistics.
BYTES_TO_UPLOAD("bytes_upload",
Copy link
Contributor

Choose a reason for hiding this comment

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

these should all be in hadoop-common where possible, so that we have consistent names everywhere for aggregation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I think apart from readAhead counter we can have all the others in common.

@@ -73,6 +78,8 @@
private long bytesFromReadAhead; // bytes read from readAhead; for testing
private long bytesFromRemoteRead; // bytes read remotely; for testing

private IOStatistics ioStatistics;
Copy link
Contributor

Choose a reason for hiding this comment

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

final?

Copy link
Contributor Author

@mehakmeet mehakmeet Oct 18, 2020

Choose a reason for hiding this comment

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

Could be null too, depending on the stream statistics instance(Which we can either be null or not, using the AbfsInputStreamContext class).

if (bytes > 0) {
bytesRead += bytes;
}
ioStatisticsStore.incrementCounter(STREAM_READ_BYTES, bytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing to consider here is the cost of the map lookup on every IOP. You can ask the IOStatisticsStore for a reference to the atomic counter, and use that direct. I'm doing that for the output stream, reviewing this patch makes me realise I should be doing it for read as well. at least the read byte counters which are incremented on every read.

  bytesUploaded = store.getCounterReference(
      STREAM_WRITE_TOTAL_DATA.getSymbol());
  bytesWritten = store.getCounterReference(
      StreamStatisticNames.STREAM_WRITE_BYTES);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip. I've added the frequently updated counters as counter ref.

.trackDurationOfCallable((IOStatisticsStore) ioStatistics,
AbfsStatistic.TIME_SPENT_ON_PUT_REQUEST.getStatName(),
() -> {
AbfsPerfTracker tracker = client.getAbfsPerfTracker();
Copy link
Contributor

Choose a reason for hiding this comment

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

given we are wrapping callables with callables, maybe the Abfs Perf tracker could join in. Not needed for this patch, but later...

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 5s #2353 does not apply to trunk. Rebase required? Wrong Branch? See https://wiki.apache.org/hadoop/HowToContribute for help.
Subsystem Report/Notes
GITHUB PR #2353
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2353/5/console
versions git=2.17.1
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

@mehakmeet
Copy link
Contributor Author

Closing this one, and opening as #2604.

@mehakmeet mehakmeet closed this Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs/azure changes related to azure; submitter must declare test endpoint
Projects
None yet
3 participants