Has anyone had the experience of the native runner...
# general
c
Has anyone had the experience of the native runner being faster than the ray runner?
j
It definitely is 🙂
Ray very slow...
🫠 1
c
haha, well that answers it 😛
j
If you're on a single machine, going native (single process, multithreaded) is definitely the way to go
👍 1
Ray spins up processes, tries to use the object store etc etc which is way too overkill on a single machine
c
Ray is wildly slower it seems, like unbelievably so. My workflow takes 2 minutes in Spark, and the native Daft runner. It has yet to finish using the ray runner after 20 minutes.
j
Can you share your workload?
c
Makes me think something has to be wrong / misconfigured.
j
If you run
df.explain()
it prints a plan we can look at
👍 1
c
workflow-explain.txt
This is sticking out to me
Number of partitions = 1
. Update: These dataframes are associated with small dataframes used in joins, each of which should be getting broadcasted.
One thing I can notice is the equivalent workflow in Spark has a number of broadcast joins happening, but I've not written that into the Daft joins.
c
could you print out the physical plan as well?
df.explain(True)
👍 1
c
full-explain.txt
I've created a simpler dag/dataframe just to benchmark the same operation across several engines. pseudo-code:
Copy code
main_data.filter(F.col("date") >= F.lit(START_DATE))
        .filter(F.col("date") <= F.lit(END_DATE))
        .join(other_data_df, on="date", how="inner")
        .select("date", "hour", "other_data_col")
        .drop_duplicates()
Copy code
2025-07-22 23:04:43.103 | INFO     | __main__:<module>:55 - Starting daft-ray engine
2025-07-22 23:10:33.641 | INFO     | __main__:<module>:72 - Time taken: 350.5385718345642 seconds in daft-ray                                                                         

2025-07-22 23:11:05.556 | INFO     | __main__:<module>:55 - Starting daft-native engine
2025-07-22 23:11:06.793 | INFO     | __main__:<module>:72 - Time taken: 1.23630952835083 seconds in daft-native

2025-07-22 23:11:35.892 | INFO     | __main__:<module>:55 - Starting spark engine
2025-07-22 23:11:49.467 | INFO     | __main__:<module>:72 - Time taken: 13.574950456619263 seconds in spark
I've tried both
daft.read_parquet(table_path, hive_partitioning=True)
and
daft.read_iceberg(...)
. Both of those work with Daft native, but so far daft w/ ray has only been successful w/ read_parquet, it is very very slow w/ read_iceberg to the point where I just stop the process after 10 mins.
simple-dag-plan.txt
Here's the plan (
explain(True)
) for the above df ☝️
daft native does in ~1s what daft ray takes nearly 6 minutes to do 🤯
c
does daft ray take 6 minutes on both
read_parquet
and
read_iceberg
?
c
daft ray + read_iceberg takes much longer than 6 minutes, so long I have yet to let it finish.
c
It may be the case that there are too many partitions / files, and because on the ray runner, generally 1 partition is mapped to 1 core at a time. What you can do to reduce this is a manual repartition (https://docs.getdaft.io/en/stable/api/dataframe/#daft.DataFrame.repartition) of the data into something smaller (# of cores for example). You can perform this after doing the
read_iceberg
👀 1
c
Ah, 1 partition per core in Ray, very handy to know! That made a huge difference. The number of partitions in my table was 4221, but after repartitioning it to 72 (number of cores on my machine), the job time went from 6 minutes to 6 seconds. 🎉
🙌 1
c
thats great to know! we're looking to add some optimizations soon here to make this partitioning more automatic, so hopefully you won't need to manually specify partitions anymore
🙌 1
c
That would be amazing, as both our workflow and cluster sizes frequently change. I think for now we’ll need to incorporate our own repartitioning heuristic based on (a) the task at hand (b) the input data size (c) cluster size.
Another issue here that seems to occur when I use
repartition
Copy code
Failed to build distributed plan, falling back to regular execution. Error: DaftError::ValueError Cannot translate logical plan: Repartition: Scheme = Random, Num partitions = Some(100), Stats = { Approx num rows = 16,048,421, Approx size bytes = 124.37 MiB, Accumulated selectivity = 1.00 } into stages
If I remove repartition that error goes away, but of course the job is very slow again.
c
Yes, we are in the midst of building out a new ray runner, https://github.com/Eventual-Inc/Daft/discussions/4724 some of the operations are not supported on there yet, specifically
Repartition: Scheme = Random
. So it falls back to using the old ray runner.
c
Ah, good to know. Is this understanding correct:
Scheme = Random
occurs when you use a numerical repartition value
df.repartition(72)
, as opposed to a column
df.repartition(None, "date")
?
c
yeah exactly!
df.repartition(None, "date")
should perform a hash-based repartition, which is currently supported in the new runner.
well to be more specific, as long as you provide a column, it will use hash based repartition, i.e.
df.repartition(72, "date")
c
ah yes, that was going to be my next question. I'm not getting the error when I use
df.repartition(72, "date")
, though this results in even slower performance than not partitioning at all. I'm not sure I understand what providing a number and a column is doing, searching through the docs atm but can't find anything describing what the behavior will be when both are provided.
c
With a hash based repartitiion like
df.repartition(72, "date")
, what's essentially happening is the data will be split into 72 partitions based on the hash of the "date" column. Basically, for each row, the new partition it belongs to is
hash(date) % 72
. What could be happening is that the values of
date
are skewed, leading to inbalanced partitions.
👍 1
c
Hi,@Colin Ho may i ask do we have any plans to replace ray based on a new distributed engine? Or will daft still be running on ray?
c
Hey @can cai, currently we don't have plans to run distributed daft outside of ray. If we do, we will update the roadmap here: https://docs.daft.ai/en/stable/roadmap/#roadmap
c
Thank you, i got it.