Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1978#discussion_r16687523
  
    --- Diff: python/pyspark/shuffle.py ---
    @@ -434,6 +437,63 @@ def _recursive_merged_items(self, start):
                     os.remove(os.path.join(path, str(i)))
     
     
    +class ExternalSorter(object):
    +    """
    +    ExtenalSorter will divide the elements into chunks, sort them in
    +    memory and dump them into disks, finally merge them back.
    +
    +    The spilling will only happen when the used memory goes above
    +    the limit.
    +    """
    +    def __init__(self, memory_limit, serializer=None):
    +        self.memory_limit = memory_limit
    +        self.local_dirs = _get_local_dirs("sort")
    +        self.serializer = serializer or 
BatchedSerializer(PickleSerializer(), 1024)
    +
    +    def _get_path(self, n):
    --- End diff --
    
    Because there will be multiple Python worker processes running on the same 
node, if they all need to spill, it looks like they'll use the same directories 
in order here. Can you instead start each one at a random ID and then increment 
that to have it cycle through?
    
    I'm not sure whether this can also affect the external hashing code, but if 
so, it would be good to fix that too (as a separate JIRA).


---
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