Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/1978#discussion_r16688107
--- 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 --
Good catch, maybe shuffling the directories randomly in the begging would
be better.
PS: Could you have a configured policy to choose local disks, such as use
the first one AMAP, it's will be useful when one of the local disks is SSD.
---
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]