Reusing intermediate results causes memory issues
@phofl đang làm issue này rồi.
Từ ngày 14/2/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Problem
Whenever we reuse intermediate results and there is a pipeline breaker (such as shuffles, joins, reductions, or groupby operations), it forces us to materialize the entire intermediate result (thus, it is breaking the pipelining that we could utilize for reuse for example between multiple element-wise operations).
This result materialization puts a hard limit on our ability to scale as I have observed in multiple TPC-H benchmark queries.
To illustrate this, run these two snippets on a cluster of your choice
With full intermediate result materialization
from dask_expr.datasets import timeseries
from distributed import Client
if __name__ == "__main__":
with Client() as client:
print(client.dashboard_link)
df = timeseries(start="2000-01-01", end="2020-12-31", freq="100ms", dtypes={"x": float})
# To compute mean, we have to fully materialize df, and we won't free its data
# until we have reused the chunks to compute a partial of the sum.
mean = df["x"].mean()
df[df["x"] > mean].sum().compute()
Without full intermediate result materialization
from dask_expr.datasets import timeseries
from distributed import Client
if __name__ == "__main__":
with Client() as client:
print(client.dashboard_link)
df = timeseries(start="2000-01-01", end="2020-12-31", freq="100ms", dtypes={"x": float})
# Compute the mean beforehand so that we don't have to keep all of `df` in memory
mean = df["x"].mean().compute()
df[df["x"] > mean].sum().compute()
Possible solution
The easiest approach would be to never reuse any intermediate results. This has a few downsides:
- Non-deterministic functions will lead to unexpected results
- We waste a lot of computational resources on recomputations
...but it will allow us to scale.
We can certainly get smarter about intermediate result materialization, but this will require some effort depending on how smart we want to be. (There's a body of (ongoing) research and implementations in the database world we could draw from.)
- Ngôn ngữ chính
- Python
- Star
- 89
- Fork
- 26
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dask/dask-expr
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Predicate pull-up optimizationĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Tất cả issue của dask/dask-expr
Issue tương tự
-
Claiming namespace `apoint`Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
EclipseFdn/open-vsx.org#13573 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
collective/icalendar#1854 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rancher/rancher-ai-agent#412 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TUDelftGeodesy/DePSI#134 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HenriquesLab/rxiv-maker#335 ·