Github user mingyukim commented on the pull request:

    https://github.com/apache/spark/pull/4420#issuecomment-73581628
  
    To be clear, I don't mean to do spill on every element. I mean to do it 
only when `currentMemory > myMemoryThreshold`. When `currentMemory > 
myMemoryThreshold`, you have two options. 1) Not try spilling and wait until 
you have enough elements cumulated since the last spill, which is what it's 
doing now, or 2) try spilling in order to avoid potential OOMs. Since spill is 
a feature that prevents executors from OOMing, I believe 2 is the right way.
    
    I agree with you that spill shouldn't be done too frequently. However, # of 
elements is a wrong proxy to use for controlling the frequency of spills 
because you never know how large each element will be. # of bytes is a better 
proxy to use here, so the Spillable data structure cumulates at least N bytes 
worth of elements (as opposed to at least M elements) before spilling again. 
You can do this by acquiring at least N bytes from shuffleMemoryManager at a 
time.
    
    What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to