Skip to content
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

Swap std::sync::mpsc channel with crossbeam_channel #7844

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

spastorino
Copy link
Member

@spastorino spastorino commented Jan 28, 2020

Hoping it closes #7840

r? @Mark-Simulacrum

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 28, 2020
@Mark-Simulacrum
Copy link
Member

r? @ehuss

@ehuss
Copy link
Contributor

ehuss commented Jan 29, 2020

I don't think we can make this change. When combined with #7838, it causes a very dramatic performance hit. Fresh builds can be many times slower (9 times slower with 500 units).

@Mark-Simulacrum
Copy link
Member

That's quite unexpected from my perspective at least -- have we done any profiling to suggest why that would be the case? Generally crossbeam-channel suggests in docs and such that it's faster/better all around than std's impl, but I guess that's not the case?

@ehuss
Copy link
Contributor

ehuss commented Jan 29, 2020

I might try digging into it more later. It looks like it is having a strange interaction with the jobserver helper thread. I can measure dropping the helper thread takes over 1s (but not always). Helper::join is a little funky in the way it uses signals, but it is not clear to me what's going on.

@alexcrichton
Copy link
Member

I don't believe we can switch to crossbeam's channels since they do not have a blocking send function which #7838 will require, so this'll likely just require more churn otherwise. I was working on #7845 yesterday but didn't get a chance to polish it until this morning, but that's the route I think we should take (just write our own simple queue).

I'll comment over there about the performance though

@ehuss
Copy link
Contributor

ehuss commented Jan 29, 2020

The issue I was seeing is dropping the job server can take up to 1 second, see rust-lang/jobserver-rs#23. I'm guessing that the change to crossbeam is just altering the behavior slightly enough for it to trigger that.

I don't believe we can switch to crossbeam's channels since they do not have a blocking send

I'm not sure what you mean by this. Crossbeam has a bounded channel, and Sender::send should block if the queue is full.

@alexcrichton
Copy link
Member

alexcrichton commented Jan 30, 2020

Ok the jobserver issue should be fixed now, sorry about that and thanks for helping to diagnose it @ehuss!

Also apologies, I was looking at the documentation for crossbeam-queue rather than crossbeam-channel, and yeah looks like crossbeam-channel has what we want.

Here's my proposed plan of action (which I'll go ahead and enact at the bottom)

@bors: r+

@bors
Copy link
Collaborator

bors commented Jan 30, 2020

📌 Commit 20ddff8 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2020
@bors
Copy link
Collaborator

bors commented Jan 30, 2020

⌛ Testing commit 20ddff8 with merge cc42c0b31c4478b6de64c52f588dc518e80990c2...

@bors
Copy link
Collaborator

bors commented Jan 30, 2020

💡 This pull request was already approved, no need to approve it again.

  • This pull request is currently being tested. If there's no response from the continuous integration service, you may use retry to trigger a build again.

@bors
Copy link
Collaborator

bors commented Jan 30, 2020

📌 Commit 20ddff8 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Jan 30, 2020

⌛ Testing commit 20ddff8 with merge 4fbd644...

bors added a commit that referenced this pull request Jan 30, 2020
Swap std::sync::mpsc channel with crossbeam_channel

Hoping it closes #7840

r? @Mark-Simulacrum
@bors
Copy link
Collaborator

bors commented Jan 30, 2020

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 4fbd644 to master...

@bors bors merged commit 20ddff8 into rust-lang:master Jan 30, 2020
bors added a commit that referenced this pull request Jan 31, 2020
[beta] Revert scalable jobserver.

This reverts #7731, #7829, and #7836.

This should prevent #7840 on beta. I feel more comfortable reverting this than merging #7844, since the impact is still unknown.
@ehuss ehuss added this to the 1.43.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cargo is entering an infinite loop
6 participants