You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Ngone51 (via GitHub)" <gi...@apache.org> on 2024/07/11 07:33:41 UTC
[PR] [SPARK-48791][CORE][3.5][3.4] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Ngone51 opened a new pull request, #47297:
URL: https://github.com/apache/spark/pull/47297
This PR backports https://github.com/apache/spark/pull/47197 to branch-3.5/3.4.
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
This PR proposes to use the `ArrayBuffer` together with the read/write lock rather than `CopyOnWriteArrayList` for `TaskMetrics._externalAccums`.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
Fix the perf regression that caused by the accumulators registration overhead using `CopyOnWriteArrayList`.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
Manually tested.
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2235830211
thanks, merging to 3.5!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2231142709
> `Scala 2.13 build with SBT` failed:
>
> ```
> [error] /home/runner/work/spark/spark/mllib-local/src/main/scala/org/apache/spark/ml/stat/distribution/MultivariateGaussian.scala:117:34: Symbol 'type scala.collection.compat.package.IterableOnce' is missing from the classpath.
> [error] This symbol is required by 'type breeze.linalg.support.LowPrioCanTraverseValues.X'.
> [error] Make sure that type IterableOnce is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
> [error] A full rebuild may help if 'LowPrioCanTraverseValues.class' was compiled against an incompatible version of scala.collection.compat.package.
> [error] val tol = Utils.EPSILON * max(d) * d.length
> [error] ^
> [error] one error found
> ```
>
> @LuciferYang Do you have any idea why `mllib` module doesnt't have the depdency of `scala-collection-compat` since we have already directly managed that dependecy in `core` module?
>
> ```
> [INFO] --- dependency:3.6.0:tree (default-cli) @ spark-mllib_2.13 ---
> [INFO] org.apache.spark:spark-mllib_2.13:jar:3.5.2-SNAPSHOT
> [INFO] +- org.scala-lang.modules:scala-parser-combinators_2.13:jar:2.3.0:compile
> [INFO] +- org.apache.spark:spark-core_2.13:jar:3.5.2-SNAPSHOT:compile
> [INFO] | \- org.scala-lang.modules:scala-xml_2.13:jar:2.1.0:compile
> [INFO] \- org.scala-lang.modules:scala-parallel-collections_2.13:jar:1.0.4:compile
> ```
I reset to 45286ca locally, then ran `build/sbt "mllib/dependencyTree" -Pscala-2.13`. In the dependency tree, I can see `[info] | +-org.scala-lang.modules:scala-collection-compat_2.13:2.7.0 [S]`, so I still have no clue about this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5][3.4] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2222407171
```
Error: ] /home/runner/work/spark/spark/core/src/main/scala-2.12/org/apache/spark/util/ArrayImplicits.scala:20: object compat is not a member of package collection
Error: ] /home/runner/work/spark/spark/core/src/main/scala-2.12/org/apache/spark/util/ArrayImplicits.scala:32: not found: value immutable
Error: ] /home/runner/work/spark/spark/core/src/main/scala-2.12/org/apache/spark/util/ArrayImplicits.scala:33: not found: value immutable
Error: [ERROR] three errors found
Error: Failed to execute goal net.alchim31.maven:scala-maven-plugin:4.8.0:compile (scala-compile-first) on project spark-core_2.12: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:4.8.0:compile failed: org.apache.commons.exec.ExecuteException: Process exited with an error: 255 (Exit value: 255) -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Error:
Error: After correcting the problems, you can resume the build with the command
Error: mvn <args> -rf :spark-core_2.12
Error: Process completed with exit code 1.
```
Maven build failed.
Looking at the dependency tree, `scala-collection-compat` is a cascading dependency of `org.scalanlp:breeze`, but the core module does not depend on `org.scalanlp:breeze`. I recommend explicitly managing the version of `scala-collection-compat` and adding it to the core module. This will not introduce any additional dependencies for Spark, as it is already included in the `spark-deps-hadoop-3-hive-2.3` list.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2223298581
Thank you for making a PR for old release branches. Could you make a separate PR for `branch-3.4` to make it sure that CI passes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2231726254
Given that `branch-3.4` PR works, could you re-trigger CI, @Ngone51 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2229014912
Thank you for making a PR for 3.4, @Ngone51 . BTW, yes, Scala 2.13 failure seems to be consistent in both 3.5 and 3.4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "Ngone51 (via GitHub)" <gi...@apache.org>.
Ngone51 commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2227657454
FYI opned a separate PR for `branch-3.4`: https://github.com/apache/spark/pull/47348.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #47297: [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList
URL: https://github.com/apache/spark/pull/47297
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48791][CORE][3.5] Fix perf regression caused by the accumulators registration overhead using CopyOnWriteArrayList [spark]
Posted by "Ngone51 (via GitHub)" <gi...@apache.org>.
Ngone51 commented on PR #47297:
URL: https://github.com/apache/spark/pull/47297#issuecomment-2227945915
`Scala 2.13 build with SBT` failed:
```
[error] /home/runner/work/spark/spark/mllib-local/src/main/scala/org/apache/spark/ml/stat/distribution/MultivariateGaussian.scala:117:34: Symbol 'type scala.collection.compat.package.IterableOnce' is missing from the classpath.
[error] This symbol is required by 'type breeze.linalg.support.LowPrioCanTraverseValues.X'.
[error] Make sure that type IterableOnce is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'LowPrioCanTraverseValues.class' was compiled against an incompatible version of scala.collection.compat.package.
[error] val tol = Utils.EPSILON * max(d) * d.length
[error] ^
[error] one error found
```
@LuciferYang Do you have any idea why `mllib` module doesnt't have the depdency of `scala-collection-compat` since we have already directly managed that dependecy in `core` module?
```
[INFO] --- dependency:3.6.0:tree (default-cli) @ spark-mllib_2.13 ---
[INFO] org.apache.spark:spark-mllib_2.13:jar:3.5.2-SNAPSHOT
[INFO] +- org.scala-lang.modules:scala-parser-combinators_2.13:jar:2.3.0:compile
[INFO] +- org.apache.spark:spark-core_2.13:jar:3.5.2-SNAPSHOT:compile
[INFO] | \- org.scala-lang.modules:scala-xml_2.13:jar:2.1.0:compile
[INFO] \- org.scala-lang.modules:scala-parallel-collections_2.13:jar:1.0.4:compile
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org