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

8294610: java/net/vthread/HttpALot.java is slow on Linux #10504

Closed
wants to merge 5 commits into from

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Sep 30, 2022

Can I please get a review for this test-only change which proposes to improve the test run duration of java/net/vthread/HttpALot.java test, on Linux? This relates to https://bugs.openjdk.org/browse/JDK-8294610

Experiments have shown that on Linux, due to delayed TCP ACKs from the client (for some previous sent data/packet), the server sent response waits for the ACKs before sending the response data (in a TCP packet). Each delayed ACK is 40 milli seconds and given the number of requests this test (intentionally) issues, the delay accumulates causing the test to take longer duration.

With the change in this PR, the test completes in around 6 to 8 seconds on a Linux system as compared to 60 odd seconds previously on the same setup. This change hasn't shown any negative impact on macos (which continues to run this test in around 5 to 6 seconds like previously). I will trigger some runs in our CI setup to make sure this works as expected in all other OS too.

As noted in the linked JBS issue, additional experiments to see if anything can be improved in the JDK network layer will be carried out separately, outside the context of this test.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8294610: java/net/vthread/HttpALot.java is slow on Linux

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10504/head:pull/10504
$ git checkout pull/10504

Update a local copy of the PR:
$ git checkout pull/10504
$ git pull https://git.openjdk.org/jdk pull/10504/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10504

View PR using the GUI difftool:
$ git pr show -t 10504

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10504.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 30, 2022

👋 Welcome back jpai! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 30, 2022
@openjdk
Copy link

openjdk bot commented Sep 30, 2022

@jaikiran The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Sep 30, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 30, 2022

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Good sleuthing Jaikiran! LGTM.
TIL; jtreg has an @comment tag!

@openjdk
Copy link

openjdk bot commented Sep 30, 2022

@jaikiran This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8294610: java/net/vthread/HttpALot.java is slow on Linux

Reviewed-by: dfuchs, alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 30 new commits pushed to the master branch:

  • c7ab1ca: 8294609: C2: Improve inlining of methods with unloaded signature classes
  • 375f02f: 8294608: Remove redundant unchecked suppression in FileDescriptor
  • d207da8: 8294533: Documentation mistake in Process::getErrorStream and getInputStream
  • da4e96d: 8276545: Fix handling of trap count overflow in Parse::Parse()
  • 48674d4: 8291428: JFR: 'jfr print' displays incorrect timestamps during DST
  • 3b1bc21: 8294307: ISO 4217 Amendment 173 Update
  • b8f9a91: 8293940: Some tests for virtual threads take too long
  • 1d26c4b: 8291022: JFR: Reduce logging in ChunkHeader constructor
  • 3efbd5f: 8294626: Improve URL protocol lower casing
  • 052a924: 8294293: Remove unused _width and _newlines field in outputStream
  • ... and 20 more: https://git.openjdk.org/jdk/compare/6f8f28e7566701b195ecc855f3e802cd7145e9aa...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 30, 2022
* @summary Stress test the HTTP protocol handler and HTTP server
* @requires vm.debug != true
* @modules jdk.httpserver
* @library /test/lib
* @compile --enable-preview -source ${jdk.version} HttpALot.java
* @comment The test launch command intentionally uses -Dsun.net.httpserver.nodelay=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe replace this "The test runs with -Dsun.net.httpserver.nodelay=true" as the words "launch command intentionally uses" aren't really needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Updated the PR to use the suggested wording.

* to enable TCP_NODELAY on the sockets "accept()"ed by the HttpServer. This is
* to avoid (occasional 40 milli seconds) delays in receiving responses from the server.
* Given the number of requests being fired in this test, the delayed responses can
* accumulate into longer test run duration
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be clearer to say that "to avoid occasional 40ms delays receiving responses from the server on Linux.". I think you can drop "Given the number ..." sentence.

* @run main/othervm/timeout=600
* --enable-preview
* -Dsun.net.httpserver.nodelay=true
Copy link
Contributor

Choose a reason for hiding this comment

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

good, I'm happy this issue was found and the HTTP server already has a way to change this option.

* @summary Stress test the HTTP protocol handler and HTTP server
* @requires vm.debug != true
* @modules jdk.httpserver
* @library /test/lib
* @compile --enable-preview -source ${jdk.version} HttpALot.java
* @comment This test runs with -Dsun.net.httpserver.nodelay=true
* to enable TCP_NODELAY on the sockets "accept()"ed by the HttpServer. This is
* to avoid occasional 40ms delays receiving responses from the server on Linux.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the update the bug tag and improving the comment. Just a minor nit is that you might want to re-flow it to avoid 1 short line and two longer lines. Ignore if you want.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Alan, what you suggest seems fine. So I've now updated the comment accordingly.

@@ -23,13 +23,18 @@

/**
* @test
* @bug 8294610

Choose a reason for hiding this comment

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

is this tag valid for a test fix -- afaik it is for a "product code fix" i.e. the test is for a fix in the product code identified by the bugid ?

Copy link
Contributor

Choose a reason for hiding this comment

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

JEP 425 added a lot of new tests but missed in @bug tag in many cases. So it should have had @bug 8284161.

Copy link
Member

@dfuch dfuch Sep 30, 2022

Choose a reason for hiding this comment

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

Good point. The JBS issue should be marked with noreg-self too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Mark, it hasn't always been clear to me when to update the @bug. The contribution guide isn't completely clear either. So I usually update the bug id if the test change is substantial (in the way it affects the test). In this case, I've now taken Alan's suggestion to include the 8284161 (the one which introduced the test for feature testing) along with the current bug id 8294610. I am willing to drop the 8294610 from the @bug if there's some agreement towards it.

Alan has marked the JBS issue as noreg-self, so that's been taken care of.

Choose a reason for hiding this comment

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

I think adding the original 8284161 is sufficient, but remove 8294610 as the convention has been not to include a test fix bugid in the @bug statement ... this is a correction I've had to apply in the past

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Mark. The @bug tag serves to identify the test that needs to be run for a particular source code change. If the changes are all in the test itself, then there's no need for that information. The JBS issue will have a noreg-self keyword indicating that the test itself needs to be run, and that there's no need for any new non-regression test to test the change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Updated the PR to remove 8294610 from the bug id

@jaikiran
Copy link
Member Author

jaikiran commented Oct 1, 2022

Tests for tier1, tier2, tier3 came back fine. I also verified on linux, windows and macos that the duration of this test is now within 5 to 8 seconds range.

@AlanBateman
Copy link
Contributor

Tests for tier1, tier2, tier3 came back fine. I also verified on linux, windows and macos that the duration of this test is now within 5 to 8 seconds range.

The test runs in test2. It's good that this issue was tracked down and the execution time is consistent now.

@jaikiran
Copy link
Member Author

jaikiran commented Oct 1, 2022

The test runs in test2

I realized it too late that this was a test-only change and running the rest of the tiers isn't necessary :)

@jaikiran
Copy link
Member Author

jaikiran commented Oct 1, 2022

Thank you everyone for the reviews.

@jaikiran
Copy link
Member Author

jaikiran commented Oct 1, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Oct 1, 2022

Going to push as commit fd59430.
Since your change was applied there have been 30 commits pushed to the master branch:

  • c7ab1ca: 8294609: C2: Improve inlining of methods with unloaded signature classes
  • 375f02f: 8294608: Remove redundant unchecked suppression in FileDescriptor
  • d207da8: 8294533: Documentation mistake in Process::getErrorStream and getInputStream
  • da4e96d: 8276545: Fix handling of trap count overflow in Parse::Parse()
  • 48674d4: 8291428: JFR: 'jfr print' displays incorrect timestamps during DST
  • 3b1bc21: 8294307: ISO 4217 Amendment 173 Update
  • b8f9a91: 8293940: Some tests for virtual threads take too long
  • 1d26c4b: 8291022: JFR: Reduce logging in ChunkHeader constructor
  • 3efbd5f: 8294626: Improve URL protocol lower casing
  • 052a924: 8294293: Remove unused _width and _newlines field in outputStream
  • ... and 20 more: https://git.openjdk.org/jdk/compare/6f8f28e7566701b195ecc855f3e802cd7145e9aa...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 1, 2022
@openjdk openjdk bot closed this Oct 1, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 1, 2022
@openjdk
Copy link

openjdk bot commented Oct 1, 2022

@jaikiran Pushed as commit fd59430.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@jaikiran jaikiran deleted the 8294610 branch October 1, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
4 participants