-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy-allocate pusher memory. #397
base: master
Are you sure you want to change the base?
Conversation
A few quick thoughts:
|
Thanks for the feedback!
Makes sense! Instead of always deallocating inside
Sorry, I'm not sure how to implement this. Are you suggesting that |
b8aeed0
to
d29fcf9
Compare
The current implementation of channel pushers preallocates `Message::default_length` entries per pusher. For very large graphs this adds up to a lot of memory being allocated even when the system is idle with no outstanding messages. This patch changes the allocation policy to only allocate channel memory when there are messages to send and to deallocate it at the end of a burst of messages (signaled by pushing a `None` message), reducing the memory footprint to 0 in idle state at the cost of some potential slow-down due to a larger number of allocations. See TimelyDataflow#394.
d29fcf9
to
9f0571f
Compare
Re-reading things, I think the |
I thought in this case the buffer would never be allocated in the first place? |
Ah good point. That may be true! |
I confirmed using out internal benchmarks that the fixed up version that only deallocates on @frankmcsherry, do you see this being merged as is or do you feel we should work on making this an optional pact? |
I'd need to think a bit before merging it as is, due to the impact on others. If it were an optional pact, it would be easy to accept. On the other hand, I'm not sure that the |
The current implementation of channel pushers preallocates
Message::default_length
entries per pusher. For very large graphs thisadds up to a lot of memory being allocated even when the system is idle
with no outstanding messages. This patch changes the allocation policy
to only allocate channel memory when there are messages to send and to
deallocate it when there are no messages, reducing the memory footprint
to 0 in idle state at the cost of some potential slow-down due to a
larger number of allocations.
See #394.