Repository navigation
Description
Some dataframe operations require something like a full sort of the data. This can be expensive for a variety of reasons. This limits the scalability of Dask Dataframe to very large datasets. These operations include:
- set_index
- groupby-apply
- join on a non-sorted column
Our current approach is to split every input partition into several pieces, move those pieces around to their final destination, and then merge them into output partitions. In an unsorted input dataset every input partition will have something to contribute to most output partitions, so this is an n**2 operation. As the number of partitions increases this an become debilitating due to scheduler overhead.
So for example if we have 1000 partitions then this might create 1,000,000 tasks, which if overhead is something like 1ms per task (an overetimate) then this would add 1000s of overhead (about 15 minutes) regardless of how large our cluster is.
Staging: Today's approach
Today we avoid this by staging communication. We split things up not into 1000 little chunks, but into 30, and we do this a couple of times. This results in n * log_n tasks and log_n full communications. In our example above we would incur something like 30,000 + 30,000 tasks, or about 10s of overhead, but we would have to move our dataset around twice (which if you're on slow network can be troublesome)
What are some other approaches that we could take here?
See also
- A similar issue for Dask Array Very large dask arrays #3514
- A plan for distributed shuffling service Distributed Partd #6164
- An approach to create tasks from tasks [WIP] Dynamic Tasks: Tasks inserting new tasks distributed#3879
Activity
mrocklin commentedon Jun 11, 2020
One approach, inspired by Spark's shuffling service, is to make a shuffle service that handles moving around all-to-all type communication patterns on the side. This is what we do today with single-machine shuffles with partd. There is more information on this topic here: #6164
mrocklin commentedon Jun 11, 2020
Another approach is to stay with
n**2tasks, but generate them on the fly. This lets us hide the overhead of processing these tasks by overlapping them with communiation. More on this topic here: dask/distributed#3879@madsbk I think that I'm representing your approach well here, but I think that you probably know more about the specifics than I do.
jakirkham commentedon Jun 12, 2020
Also issue ( #6163 ) and issue ( dask/distributed#3783 ) are related.