-
Couldn't load subscription status.
- Fork 984
Remove lifetime parameters to allow multi-threaded installations #4567
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
base: main
Are you sure you want to change the base?
Remove lifetime parameters to allow multi-threaded installations #4567
Conversation
…hread installations Co-authored-by: rami3l <[email protected]>
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.
LGTM, thanks :)
|
Did you both miss my comment from the other PR opposing these changes? Or did I miss some response to that? |
@djc You have been giving very important and insightful review comments, but I believe we might be having some sort of a misunderstanding here. If you meant #4471 (review):
The latest update of #4471 doesn't use channels anymore (it's not finished as the refactor should be squashed back), but removing lifetimes are still required to send the current transaction to a new task, since without spawning (say up to b5e9e4d), the feature shouldn't work on it's own and no performance boost is introduced. @FranciscoTGouveia has, in fact, asked me the very question upon finishing the first commit wondering why the performance was not improved; we deduced together and concluded that a separate thread for installation is required because most of it is still sync and, as we have previously agreed, the installer itself will stay sync for now (#4159). I've always wanted to minimize the diff to land the change, so I understand your concern of certain commits being too huge to revert and/or a move in the wrong direction. Of course we could be missing some crucial factors in your envisioned solution if the changes proposed in this PR are really not required. In that case we'd be happy to know. |
|
PS: Also, on a general sense, tokio seems to dislike the lifetime dance so I doubt whether changes like this won't spread in the future despite being a bit unfortunate. |
Ah, cool. I was referring also to #4471 (comment):
So I'm suggesting that downloading happens concurrently by storing a bunch |
@djc IIRC the latest update of #4471 is doing exactly that. Are you suggesting something like I'm asking this because we have failed to move downloads to another thread via a UpdateIt looks like the above error comes from here: Lines 92 to 101 in d676c6f
Either way it seems like it's about doing the remove refcell/lifetime dance either with the downloading or the installing code. |
I'm suggesting we don't need to send the installer to another thread at all, because the downloads will continue for a bit in the background even if the main task is not polling them. |
@djc Given a sync function call blocking a certain thread, how can other tasks make progress if we don't have other threads to use? If you are talking about sending downloading tasks to other threads first (instead of sending the installer), then we are on the same page now. However, as explained in #4567 (comment), it's not immediately possible either since it requires a dance similar to this PR. Of course I can experiment on that direction and see which approach will result in a smaller diff. |
I'm pretty sure you're modelling async I/O wrong in your head. Once we have initiated a download, TCP frames are going to continue to come in (modulo flow control and congestion management). Thus, we don't need to continuously poll the I/O tasks in order for the downloads to make progress, we can execute on an installation and then poll the downloads again.
No, as I've tried to explain several times now I'm suggesting we don't send any tasks to other threads. |
|
@djc Thanks for your clarification. It is true that the downloads that have been initiated will not be influenced, but the expected behavior also includes the normal initiation of new downloads when a component is being unpacked (which is very important when large components such as My confusion is that it seems this cannot be handled using the naive blocking approach, but of course I'd be glad to be corrected. |
Okay, that makes a little more sense. I submitted #4570 which substantially simplifies the core goal of concurrent downloading & installation. I suggest we use that as a starting point to figure out what the effect is with large installations like |
Cherry-picked from #4471, in response to #4471 (comment).