comphead commented on PR #7655:
URL: 
https://github.com/apache/datafusion-comet/pull/7655#issuecomment-7066834796

   @andygrove one more change on the memory side, in f97aa48ad2. There is no 
timer any more. The executor keeps the copy after its last task until Spark 
removes the broadcast from the executor, which is how Spark keeps its own 
broadcast values.
   
   - `CometBroadcastValue` is now `AutoCloseable`. Since 
[SPARK-35396](https://issues.apache.org/jira/browse/SPARK-35396) (Spark 3.2), 
the memory store closes an `AutoCloseable` value when its block leaves memory: 
when the broadcast is unpersisted or destroyed, when the driver cleans it up, 
when the memory store evicts it, and when the executor stops. `close()` frees 
the kept copy, and from then on the value frees each copy as soon as no task 
holds it.
   - `spark.comet.exec.broadcastExchange.shareDecoded.idleTimeout` and its 
expiry thread are gone. `maxIdleSize`, 128 MiB by default, still caps the kept 
copies of all broadcasts on an executor, and a cap of 0 frees a copy as soon as 
no task holds it. `CometTestBase` sets it to 0.
   - A new test destroys a real broadcast and checks that the memory store 
closed the value and freed its kept copy.
   
   I did not free the copy when the query ends. Executors hear nothing from 
Spark at that point, and `unpersist` would skip the driver's block manager, the 
only one in local mode, and drop the executors' copies of the broadcast as 
well. Doing it the way Gluten does would need a message from the driver to 
every executor.
   
   The trade-off is residency. The driver cleans up a broadcast only after it 
garbage-collects it, so in a long-running application the kept copies now stay 
until the cap evicts them, rather than for 1 s. A value that never fits in the 
executor's memory store is never closed, and only the cap bounds its copy. 
Given that, would you rather have a lower default than 128 MiB?
   
   The benchmark numbers in the description come from the timer revisions. 
Within a query both keep the same copies, so I expect the same task times, but 
I have not re-run them yet.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to