You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "viirya (via GitHub)" <gi...@apache.org> on 2024/07/18 23:04:50 UTC

[PR] doc: Add memory tuning section to user guide [datafusion-comet]

viirya opened a new pull request, #684:
URL: https://github.com/apache/datafusion-comet/pull/684

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## How are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#discussion_r1683599214


##########
docs/source/user-guide/tuning.md:
##########
@@ -21,6 +21,17 @@ under the License.
 
 Comet provides some tuning options to help you get the best performance from your queries.
 
+## Memory Tuning
+
+Comet currently doesn't share the memory allocation from Spark but owns its own memory allocation.
+That's said, Comet requires additional memory to be allocated. Comet provides some memory related configurations to help you tune the memory usage.
+
+By default, the amount of memory is `spark.comet.memory.overhead.factor` * `spark.executor.memory`.

Review Comment:
   I think we need to specify the precedence as well.
   What if both `spark.comet.memory.overhead.factor` and `spark.comet.memoryOverhead` are set ?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#discussion_r1684397942


##########
docs/source/user-guide/tuning.md:
##########
@@ -21,6 +21,17 @@ under the License.
 
 Comet provides some tuning options to help you get the best performance from your queries.
 
+## Memory Tuning
+
+Comet currently doesn't share the memory allocation from Spark but owns its own memory allocation.
+That's said, Comet requires additional memory to be allocated. Comet provides some memory related configurations to help you tune the memory usage.
+
+By default, the amount of memory is `spark.comet.memory.overhead.factor` * `spark.executor.memory`.
+`COMET_MEMORY_OVERHEAD_FACTOR`'s default value is 0.2. You can increase the factor to require more
+memory for Comet to use, if you see OOM error.

Review Comment:
   As well as solving OOM, would increasing the memory help with performance?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#discussion_r1684397109


##########
docs/source/user-guide/tuning.md:
##########
@@ -21,6 +21,17 @@ under the License.
 
 Comet provides some tuning options to help you get the best performance from your queries.
 
+## Memory Tuning
+
+Comet currently doesn't share the memory allocation from Spark but owns its own memory allocation.
+That's said, Comet requires additional memory to be allocated. Comet provides some memory related configurations to help you tune the memory usage.
+
+By default, the amount of memory is `spark.comet.memory.overhead.factor` * `spark.executor.memory`.
+`COMET_MEMORY_OVERHEAD_FACTOR`'s default value is 0.2. You can increase the factor to require more

Review Comment:
   Using the internal variable name could cause confusion.
   
   ```suggestion
   The default value for `spark.comet.memory.overhead.factor` is 0.2. You can increase the factor to require more
   ```



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya merged PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#discussion_r1684894745


##########
docs/source/user-guide/tuning.md:
##########
@@ -21,6 +21,17 @@ under the License.
 
 Comet provides some tuning options to help you get the best performance from your queries.
 
+## Memory Tuning
+
+Comet currently doesn't share the memory allocation from Spark but owns its own memory allocation.
+That's said, Comet requires additional memory to be allocated. Comet provides some memory related configurations to help you tune the memory usage.
+
+By default, the amount of memory is `spark.comet.memory.overhead.factor` * `spark.executor.memory`.
+`COMET_MEMORY_OVERHEAD_FACTOR`'s default value is 0.2. You can increase the factor to require more
+memory for Comet to use, if you see OOM error.

Review Comment:
   Added a few sentences about performance impact.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#discussion_r1684893189


##########
docs/source/user-guide/tuning.md:
##########
@@ -21,6 +21,17 @@ under the License.
 
 Comet provides some tuning options to help you get the best performance from your queries.
 
+## Memory Tuning
+
+Comet currently doesn't share the memory allocation from Spark but owns its own memory allocation.
+That's said, Comet requires additional memory to be allocated. Comet provides some memory related configurations to help you tune the memory usage.
+
+By default, the amount of memory is `spark.comet.memory.overhead.factor` * `spark.executor.memory`.

Review Comment:
   `spark.comet.memoryOverhead` will be used. Let me add it.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "orthoxerox (via GitHub)" <gi...@apache.org>.
orthoxerox commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2286007569

   Am I correct in assuming I don't have to increase `spark.executor.memoryOverhead` or `spark.memory.offHeap.size` when using Comet, only `spark.comet.memoryOverhead`? How does this interact with YARN memory management?


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2287067051

   > @comphead Hm, interesting, I tried launching the container with and without specifying `spark.comet.memoryOverhead` and YARN reported the same amount of memory allocated to my application. I'll check again tomorrow with debug enabled, hopefully I'll see this: https://github.com/apache/datafusion-comet/blob/acb78280e495079312a1067b80e91671852389a5/spark/src/main/scala/org/apache/spark/Plugins.scala#L63C7-L63C14
   
   @orthoxerox please try it with applying a separate plugin 
   ```
   --conf spark.plugins=org.apache.spark.CometPlugin
   ```


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "orthoxerox (via GitHub)" <gi...@apache.org>.
orthoxerox commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2287042699

   @comphead Hm, interesting, I tried launching the container with and without specifying `spark.comet.memoryOverhead` and YARN reported the same amount of memory allocated to my application. I'll check again tomorrow with debug enabled, hopefully I'll see this: https://github.com/apache/datafusion-comet/blob/acb78280e495079312a1067b80e91671852389a5/spark/src/main/scala/org/apache/spark/Plugins.scala#L63C7-L63C14


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2240883368

   Merged. Thanks @andygrove @comphead 


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2286729128

   `spark.comet.memoryOverhead` configures the memory pool size for native execution. it is not the same as `spark.executor.memoryOverhead` or `spark.memory.offHeap.size`.
   
   For YARN memory management, the YARN container respects the `spark.executor.memoryOverhead` and the Comet override this value in `CometDriverPlugin`
   
   ```      
   sc.conf.set(EXECUTOR_MEMORY_OVERHEAD.key, s"${execMemOverhead + cometMemOverhead}M")
   ```
   
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] doc: Add memory tuning section to user guide [datafusion-comet]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on PR #684:
URL: https://github.com/apache/datafusion-comet/pull/684#issuecomment-2286868125

   If Comet `CometPlugin` is configured to be used, it will update Spark executor overhead based on the config value `spark.comet.memoryOverhead` etc. But I don't test it on YARN, not sure Spark plugins comes in before YARN's resource configuration. You probably can test it.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org