TimelyDataflow / TimelyDataflow/timely-dataflow
Lazy memory allocation in channel pushers.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 293
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 4
Description
We have an application that builds a very large dataflow graph (thousands of operators) and creates hundreds of concurrently running instances of this graph. Heap profiling showed that the application wastes a lot of memory in channel pushers, which maintain Message::default_length entries even when the system is idle with no outstanding messages.
I understand that this is a performance optimization that reduces the number of malloc calls, but the memory overhead was not acceptable for our use case, so I created a patch that changes the allocation policy to only allocate channel memory (in chunks of Message::default_length entries) when there are messages to send and to deallocate it when there are no messages, reducing the memory footprint to 0 in idle state: https://github.com/ddlog-dev/timely-dataflow/commit/a94e1763756d01d938d2e0b0ec91c8fd00fc130d
@frankmcsherry , any chance you'd accept a cleaned up version of this patch as a PR? I realize that it caters for a somewhat idiosyncratic use case, but it doesn't seem to cause a measurable slow down in my experiments and it does save memory.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the referenced commit a94e1763756d01d938d2e0b0ec91c8fd00fc130d and the channel pusher allocation code it changes. Verify that channel memory is allocated in Message::default_length chunks only when messages are pending and released when the channel is idle. Compare the behavior and performance with the existing implementation before preparing a cleaned-up change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- distributed-systems, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100