maven-resolver icon indicating copy to clipboard operation
maven-resolver copied to clipboard

[MRESOLVER-7] download poms in parallel

Open caiwei-ebay opened this issue 3 years ago • 20 comments
trafficstars

This PR is for parallel POM downloading, the idea is a bit different than https://github.com/ibabiankou/maven-resolver/pull/2/files:

  • only parallelize the VersionRange and ArtifactDesciptor resolution part (poms.xml & maven-metadata.xml downloading in parallel) as the poms downloading or maven-metadata.xml is the most slow part.
  • Pure dependency resolution logic and the skip logic are still run in sequence.

caiwei-ebay avatar May 16 '22 11:05 caiwei-ebay

@michael-o @cstamas @ibabiankou

I think the code is already ready for review, I would like to run more tests before converting the PR from Draft to final. Please help review and share your comments with this PR.

caiwei-ebay avatar May 16 '22 11:05 caiwei-ebay

@michael-o

Created separate PR for moving the PremanagedDependency class. https://github.com/apache/maven-resolver/pull/179

caiwei-ebay avatar May 17 '22 00:05 caiwei-ebay

Separated the PR for PremanagedDependency refactoring and rebased the code.

caiwei-ebay avatar May 17 '22 09:05 caiwei-ebay

Much simpler to read now...

michael-o avatar May 17 '22 17:05 michael-o

Something is wrong here, unsure what. But, I tried to build maven master using maven-3.9.x + this PR + empty local repo and it fails:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile (default-testCompile) on project maven-model-builder: Compilation failure: Compilation failure: 
[ERROR] /home/cstamas/Worx/apache-maven/maven/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java:[36,27] package org.hamcrest does not exist
[ERROR] /home/cstamas/Worx/apache-maven/maven/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java:[36,1] static import only from classes and interfaces
[ERROR] /home/cstamas/Worx/apache-maven/maven/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java:[37,27] package org.hamcrest does not exist
[ERROR] /home/cstamas/Worx/apache-maven/maven/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java:[37,1] static import only from classes and interfaces
[ERROR] -> [Help 1]

The cmd used to test:

[cstamas@infinity maven (maven-3.9.x)]$ ~/bin/maven/apache-maven-3.9.0-SNAPSHOT/bin/mvn clean install -Dmaven.repo.local=local-repo -Drat.skip -DskipTests -Daether.collector.impl=bf

cstamas avatar Jun 06 '22 17:06 cstamas

@cstamas I can reproduce. Let me do some research.

caiwei-ebay avatar Jun 09 '22 06:06 caiwei-ebay

@michael-o @cstamas

I have converted the PR from draft to ready. Please help review.

The basic idea of this PR is:

  • Given dependency A's children B, C, D
  • Iterate B, C, D one by one, take B as example below.
  • Should B be filtered? If yes, won't add to the queue. Logic here
  • If B should not be filtered, then figure out the managed version of B, ex B1, resolve B1's descriptor in a thread, then add B1 to the queue. Logic here

In such way, poms and metadata.xml will be downloaded in parallel.

The issue @cstamas raised has been fixed. The failure was caused incorrect filtering (should filter with original dependency, B instead of B1 as described in above flow)

Also runs the ITs with both DF and BF (code based on this PR) mode, same test result below: 2 tests that are not related with this PR failed in both modes. Not sure if this is as expected.

[ERROR] Failures: [ERROR] MavenITmng5576CdFriendlyVersions>AbstractMavenIntegrationTestCase.runTest:260->testContinuousDeliveryFriendlyVersionsAreWarningFreeWithBuildConsumer:98 [WARNING] [ERROR] MavenITmng5576CdFriendlyVersions>AbstractMavenIntegrationTestCase.runTest:260->testContinuousDeliveryFriendlyVersionsAreWarningFreeWithoutBuildConsumer:67 [WARNING] [INFO] [ERROR] Tests run: 912, Failures: 2, Errors: 0, Skipped: 0

Also dry-run 1000+ apps in our company by comparing the maven dependency tree with DF and BF mode (code based on this PR), no issues found so far. Test method like this:

  • mvn clean install -DskipTests -Daether.collector.impl=bf -Dmaven.repo.local=bf
  • mvn dependency:tree -DoutputFile=bf-tree.txt -Daether.collector.impl=bf -Dmaven.repo.local=bf
  • mvn clean install -DskipTests -Dmaven.repo.local=df
  • mvn dependency:tree -DoutputFile=df-tree.txt -Dmaven.repo.local=df
  • compare bf-tree.txt df-tree.txt

Please help review and feel free to let me know if anything I can help.

caiwei-ebay avatar Jun 23 '22 11:06 caiwei-ebay

@michael-o @cstamas Folks, please help review the PR and let me know if anything needs from me. This PR can make poms/metadata.xml download much faster.

caiwei-ebay avatar Jul 06 '22 13:07 caiwei-ebay

Will do around weekend, busy few days till then.

cstamas avatar Jul 06 '22 14:07 cstamas

Will likely happen either this Friday or in 10 days. I think this should not be in Maven 3.9.0 just to avoid any breakings.

michael-o avatar Jul 06 '22 18:07 michael-o

Any updates on this PR? Can we expect it to be merged soon?

I'm a contributor of JDT Language Server, and one of our core component m2e is depending on maven-resolver. We've been observing that downloading poms one by one takes a lot of time when importing Maven projects. To be honest, it's one of our performance bottleneck and we can hardly improve it on our own, in downstream... So it would be great if this improvement can be shipped in coming releases.

Eskibear avatar Aug 09 '22 02:08 Eskibear

Any updates on this PR? Can we expect it to be merged soon?

I'm a contributor of JDT Language Server, and one of our core component m2e is depending on maven-resolver. We've been observing that downloading poms one by one takes a lot of time when importing Maven projects. To be honest, it's one of our performance bottleneck and we can hardly improve it on our own, in downstream... So it would be great if this improvement can be shipped in coming releases.

Friends, the PR is under review. Feel free to participate into the contribution. :)

caiwei-ebay avatar Aug 09 '22 08:08 caiwei-ebay

Any updates on this PR? Can we expect it to be merged soon?

I'm a contributor of JDT Language Server, and one of our core component m2e is depending on maven-resolver. We've been observing that downloading poms one by one takes a lot of time when importing Maven projects. To be honest, it's one of our performance bottleneck and we can hardly improve it on our own, in downstream... So it would be great if this improvement can be shipped in coming releases.

Proper evaluation I'd mandatory, we already had severe regressions due to the previous approach.

michael-o avatar Aug 09 '22 08:08 michael-o

Proper evaluation I'd mandatory

I understand and appreciate all the work you guys have done. If I remember clearly, some integration tests and details were discussed in a private ASF slack channel which I had no access...

Just want to know if there's any ETA (already one month since last update)? Anyway, please let me know if there's anything I can help (if that would help to proceed this).

Eskibear avatar Sep 05 '22 05:09 Eskibear

Proper evaluation I'd mandatory

I understand and appreciate all the work you guys have done. If I remember clearly, some integration tests and details were discussed in a private ASF slack channel which I had no access...

Just want to know if there's any ETA (already one month since last update)? Anyway, please let me know if there's anything I can help (if that would help to proceed this).

@cstamas we need to discuss this sometime this month.

michael-o avatar Sep 05 '22 10:09 michael-o

Proper evaluation I'd mandatory

I understand and appreciate all the work you guys have done. If I remember clearly, some integration tests and details were discussed in a private ASF slack channel which I had no access... Just want to know if there's any ETA (already one month since last update)? Anyway, please let me know if there's anything I can help (if that would help to proceed this).

@cstamas we need to discuss this sometime this month.

@michael-o @cstamas

May I know the latest status of discussion? Please never hesitate to let me know if anything I can help or the code I should revise.

caiwei-ebay avatar Sep 28 '22 06:09 caiwei-ebay

@caiwei-ebay will get to it soon, sorry for delay....

cstamas avatar Sep 28 '22 12:09 cstamas

For me, this won't happen before October.

michael-o avatar Sep 28 '22 12:09 michael-o

@michael-o How's everything? Got a chance to give more comments to this PR? And may I know what's the remaining steps to get this PR merged?

caiwei-ebay2 avatar Oct 13 '22 14:10 caiwei-ebay2

@michael-o can you please specify what changes are requested with your "change request" PR review? It is unclear to me. As for me, this PR is good to merge (and probably improve it later re shared executor, but is def out of scope for this PR)

cstamas avatar Oct 19 '22 10:10 cstamas