-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Reduce state size #13970
Reduce state size #13970
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
In general, this PR reduces the size of the state, but we could go one step further and keep the circulating state bounded.
If I'm not missing something, calls
are essentially only useful for Flow, and not for Work, therefore we could avoid transmitting the whole calls
down to Work (and up to FE).
If users want to display the status of calls, they may want to explicitly record those statuses in the circulating state from Flow.
Keeping call info in the flow only would make circulating state (which is what is causing the slowdown) considerably smaller and avoid it to grow. Then, when it's time to serialize, we would serialize call info together with Flow. This is just about avoiding to send call info around.
Hey @lantiga, Quote: This is already done this way right there: https://github.com/Lightning-AI/lightning/pull/13970/files#diff-5347e507417db0b69cdee291b23e64f0105cf382f743f8f2d7e60f308cf05b5dR65. I am popping the |
Ah, awesome. I didn’t catch that. Perfect, it would be good to add a comment and making it more prominent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement 🚀
I wouldn't close #13944 as completed yet, since the memory could still grow if calling the works with multiple arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. I added two comments to require further clarification.
(cherry picked from commit 5479c60)
(cherry picked from commit 5479c60)
What does this PR do?
This PR optimizes the size of the state. From benchmarking with the following example, the state seems to be 2 times smaller overall.
On master, we reached 0.1MB at counter 46.
With this PR, we reached 0.1MB at counter 95.
Parts of #13944
Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃
cc @Borda @tchaton @rohitgr7