Skip to content

Optionally flush container builders#668

Merged
frankmcsherry merged 6 commits into
TimelyDataflow:masterfrom
antiguru:exchange_flush
Jun 24, 2025
Merged

Optionally flush container builders#668
frankmcsherry merged 6 commits into
TimelyDataflow:masterfrom
antiguru:exchange_flush

Conversation

@antiguru

@antiguru antiguru commented Jun 16, 2025

Copy link
Copy Markdown
Member

Flush container builders in exchange channels and session buffers, if they need to. This avoids a problem where we'd have a quadratic amount of lingering memory in the exchange channel. The change adds a relax function to container builders, which by default does nothing. Container builders can use it to release resources when called, and Timely calls it when it believes it's a good moment to flush. This corresponds to pushing a None value, which happens once an operator ceases to produce data.

I don't like the solution very much because it seems to conflate different concepts, but it seems like a small API change without too much negative impact.

Edit: changed the name from flush to relax for the lack of a better term.

@frankmcsherry

Copy link
Copy Markdown
Member

I think in principle a good idea, but we should discuss the name! At least, flush elsewhere (and even in the updated method) is about ensuring that any currently buffered results get shipped, where I think here it is more about deallocation. I wonder if we can find a better name (nothing leaps to mind, but e.g. chill()).

@antiguru

Copy link
Copy Markdown
Member Author

Changed the name of the function to relax, at least that's not a concept we have in Timely yet.

Comment thread timely/examples/columnar.rs
Comment thread container/src/lib.rs Outdated

@frankmcsherry frankmcsherry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good in spirit, but have a few nits about the API. Mostly being clear exactly what relax should do, and making sure it does this in the one implementation.

antiguru added 4 commits June 24, 2025 15:15
Gives container builders the option to drop their allocations in flush in
exchange. Other places might benefit from this, too, but exchange has a
quadratic number of builders, so not dropping large allocations is can
cause a memory regression.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>

@frankmcsherry frankmcsherry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge once green!

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
@frankmcsherry frankmcsherry merged commit eff40d5 into TimelyDataflow:master Jun 24, 2025
8 checks passed
@antiguru antiguru deleted the exchange_flush branch June 24, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants