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

Enable fully threaded IO for installs #1876

Merged
merged 7 commits into from Jun 15, 2019
Merged

Conversation

rbtcollins
Copy link
Contributor

@rbtcollins rbtcollins commented May 26, 2019

See the individual commits for what this patch does, but in short on all platforms it will use up to CPU-count threads during unpacking, will no longer do a separate pass to set permissions, and may use more memory. Uninstall hasn't been optimised yet (and upgrades perform uninstalls, so the instructions below separate the steps for better reporting of results)

I'd like to get some wider testing that we've had so far. I can supply test binaries if needed, but its very easy to test with:

git clone https://github.com/rust-lang/rustup.rs.git
cd rustup.rs
git fetch origin pull/1876/head:threadedio
git checkout threadedio
cargo build --release
cp target/release/rustup{-init,} #.exe if you are on windows
./target/release/rustup uninstall nightly
./target/release/rustup/install nightly

Let us know how this goes. I'm particularly interested in knowing any regressions that would make it unsuitable for merging.

This is known not to solve WSL performance issues: #1866.
It is thought to help with NFS issues #1867 and should further help windows installation times #1540.

@kinnison
Copy link
Contributor

What does this mean in terms of max open handles to close? is that limited to the number of hardware threads too?

@rbtcollins
Copy link
Contributor Author

rbtcollins commented May 26, 2019 via email

@kinnison
Copy link
Contributor

I assume you'll be recommending they build a version to trial from your branch then? If you want it merged before then, then we should open an issue to block 1.19.0 to ensure we don't forget to get the rlimits or similar in place should we not back this out.

@kinnison
Copy link
Contributor

Also, on the off-chance that we can work out why appveyor is squiffing, if you rebase onto master, we have RUST_BACKTRACE=1 set for at least some of the testing. It may not get everything but it might help a bit.

@saethlin
Copy link
Member

I'd like to test this but I'm not really sure how. I've cloned @rbtcollins bug-1866, but when I build the only binary I get is rustup-init. Do I have to uninstall my other rustup then re-init the whole thing with this?

@kinnison
Copy link
Contributor

kinnison commented May 26, 2019

@saethlin The binary is called rustup-init you can install it without having to uninstall your current version by running it directly. For testing locally I simply do cargo run -- -v -y --no-modify-path.

Once you've done that it should have installed into the usual place (~/.cargo.bin) and you can run rustup toolchain install --no-self-update nightly or somesuch to test the speed. Remember the --no-self-update or else it'll download and replace itself with the release version after installing the channel you select.

Once you're done with your testing you can simply do rustup self update and it'll download and install the current release instead of your locally built copy.

@rbtcollins
Copy link
Contributor Author

What I normally do is build it with cargo build ---release, then cp target/release/rustup{-init,} and finally ./target/release/rustup install nightly (or whatever) - that way I don't care what rustup is installed.

@saethlin
Copy link
Member

saethlin commented May 26, 2019

No improvement, ~5 second regression but that's within measurement uncertainty here.

info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-05-26, rust version 1.36.0-nightly (f49269398 2019-05-25)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  24.4 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 60.7 MiB /  60.7 MiB (100 %)  23.5 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   8.8 MiB/s in  9s ETA:  0s
info: installing component 'rust-std'
 60.7 MiB /  60.7 MiB (100 %)   9.1 MiB/s in  7s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.0 MiB /  11.0 MiB (100 %) 443.2 KiB/s in  2m  3s ETA:  0s

@rbtcollins
Copy link
Contributor Author

rbtcollins commented May 26, 2019 via email

@rbtcollins rbtcollins force-pushed the bug-1866 branch 2 times, most recently from 12c60c8 to c3e1732 Compare May 30, 2019 09:38
@rbtcollins
Copy link
Contributor Author

@saethlin could you please give this a spin on your NFS home dir? It's not adaptively throttled or tuned yet, but it should do a much better job of latency hiding - or at least I hope it will; I will be adding the requisite instrumentation to add those features soon, but if this doesn't actually trample your server - if its safe - then I'd like to see about getting the work merged incrementally. If it does have negative impact, then we need to wait for the improved IO work.

@saethlin
Copy link
Member

Looks like a substantial improvement, and I can't detect any trampling. Nice!

info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-05-30, rust version 1.37.0-nightly (37d001e4d 2019-05-29)
info: downloading component 'rustc'
 86.0 MiB /  86.0 MiB (100 %)  60.6 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
 60.4 MiB /  60.4 MiB (100 %)  28.8 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.0 MiB /  86.0 MiB (100 %)  13.9 MiB/s in  6s ETA:  0s
info: installing component 'rust-std'
 60.4 MiB /  60.4 MiB (100 %)  16.9 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.0 MiB /  11.0 MiB (100 %) 233.6 KiB/s in 15s ETA:  0s

@rbtcollins
Copy link
Contributor Author

Sweet, down from 1m 58s. Me likey!

@rbtcollins
Copy link
Contributor Author

I'm going to add more instrumentation and so forth before we merge this, but you're welcome to use this branch for now :)

@rbtcollins rbtcollins changed the title Enable threaded closing on all platforms. Enable fully threaded IO May 31, 2019
@Coder-256
Copy link

I wonder if "WslFs" might have something to do with this? More info

@kinnison
Copy link
Contributor

kinnison commented Jun 3, 2019

@rbtcollins Are you close to wanting this to be properly reviewed? I don't see changes since your comment about adding instrumentation.

@rbtcollins
Copy link
Contributor Author

my calculations say 800ms+ of that 15 are in mkdir today, so might reasonably be able to get to 15s before we look at parallel decode of components, and or streaming decode of components. I'll worry about that and refactoring to support that when the time comes. For now, I think the win is sufficiently large and clear that I'm going to just beat things into a somewhat happier shape and then ask for review for merging.

@rbtcollins
Copy link
Contributor Author

But I do think I need to detect large latency spikes otherwise we can make things worse dispatching IO into e.g. overloaded old disks or whatever. So hopefully this week I'll wrap that up.

@rbtcollins rbtcollins force-pushed the bug-1866 branch 4 times, most recently from 9fa59ae to 5e314d7 Compare June 6, 2019 05:16
Set RUSTUP_CLOSE_THREADS=disabled to force single threaded IO, or
to a specific number if desired for testing/tuning.

This may improve rust-lang#1867, but has no impact on rust-lang#1866 due to the coarse
lock around the fd-handle table inside WSL.
Generalises the threaded IO closing to be fully threaded disk IO.
Adds a new environment variable to control tracing. Tracing is
manual and can be expanded. We can probably get better systemic
tracing from a suite of platform specific tools over time, but for
now this was low hanging fruit that allows pretty good insight
without too much code intrusion. Runtime overhead when disabled
is extremely low (I can unpack rust-docs on Linux in 1s).
@rbtcollins
Copy link
Contributor Author

I wonder if "WslFs" might have something to do with this? More info

I don't think so: the plan9 fs stuff is super interesting but thats for interop with windows mounted dirs as opposed to working with the WSL owned dirs, isn't it?

@rbtcollins rbtcollins changed the title Enable fully threaded IO Enable fully threaded IO for installs Jun 6, 2019
This was only needed because we were not controlling the permissions
accurately during unpack, which can now be corrected.
@Walther
Copy link

Walther commented Jun 7, 2019

Saw the request for testing, here's a couple data points :)

MacBook Pro (15-inch, 2018)

stable rustup on macbook pro
rustup install nightly
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 81.9 MiB /  81.9 MiB (100 %)   4.6 MiB/s in 17s ETA:  0s
info: downloading component 'rust-std'
 56.1 MiB /  56.1 MiB (100 %)   5.1 MiB/s in  9s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   7.5 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 81.9 MiB /  81.9 MiB (100 %)  15.4 MiB/s in  5s ETA:  0s
info: installing component 'rust-std'
 56.1 MiB /  56.1 MiB (100 %)  17.6 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   2.2 MiB/s in  4s ETA:  0s

  nightly-x86_64-apple-darwin installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates
threadedio rustup on macbook pro
./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 81.9 MiB /  81.9 MiB (100 %)   4.2 MiB/s in 19s ETA:  0s
info: downloading component 'rust-std'
 56.1 MiB /  56.1 MiB (100 %)   4.2 MiB/s in 15s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   5.8 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 81.9 MiB /  81.9 MiB (100 %)  16.9 MiB/s in  4s ETA:  0s
info: installing component 'rust-std'
 56.1 MiB /  56.1 MiB (100 %)  19.3 MiB/s in  2s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   7.2 MiB/s in  1s ETA:  0s

  nightly-x86_64-apple-darwin installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

Results: Ran this a couple of times with similar results, small improvements on rustc and rust-std, bigger improvement on rust-docs.


On a shared shell server

stable rustup on a shell server
rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  46.3 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)  41.1 MiB/s in  1s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   5.5 MiB/s in 13s ETA:  0s
info: installing component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)   6.0 MiB/s in 12s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 440.0 KiB/s in  2m 28s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates
rustup install nightly  21.57s user 11.53s system 15% cpu 3:32.77 total
threadedio rustup on a shell server
./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  31.3 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)  30.7 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 4227040 bytes failedzsh: abort      ./rustup install nightly


---


./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 12377504 bytes failedzsh: abort      ./rustup install nightly

---

./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  70.3 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 12377504 bytes failedzsh: abort      ./rustup install nightly

---

./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  39.3 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)  39.8 MiB/s in  1s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 4227040 bytes failedzsh: abort      ./rustup install nightly

---

./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  78.5 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 12377504 bytes failedzsh: abort      ./rustup install nightly


Results: Due to the nature of its usecase, the shared shell server has limited RAM availability per-user and slow IO (HDD-based storage & lots of users). Interestingly enough, on five attempts, rustup from this branch failed at installing nightly, failing on memory allocation. I managed to install nightly with the stable rustup three times out of three attempts on the same shell server.

@rbtcollins
Copy link
Contributor Author

rbtcollins commented Jun 7, 2019

Saw the request for testing, here's a couple data points :)

Awesome, thank you.

On a shared shell server
stable rustup on a shell server

info: installing component 'rustc'
memory allocation of 4227040 bytes failedzsh: abort ./rustup install nightly
Results: Due to the nature of its usecase, the shared shell server has limited RAM availability per-user and slow IO (HDD-based storage & lots of users). Interestingly enough, on five attempts, rustup from this branch failed at installing nightly, failing on memory allocation. I managed to install nightly with the stable rustup three times out of three attempts on the same shell server.

I presume this is ulimit based? Is it a hard limit or soft? (e.g. could rustup raise it to a higher limit if we made a setrlimit call?

Could you please try this branch with

  1. RUSTUP_IO_THREADS=disabled
  2. RUSTUP_IO_THREADS=1
  3. RUSTUP_IO_THREADS=2
  4. ... etc and see if that works around the memory allocation error, when it turns up : I'm ok with some corner cases having to run rustup differently, but not with it being entirely broken!

Also if you can share some details:

  • your memory rlimits - both hard and soft
  • cpu count being reported to rust?

Assuming IO thread disabling worked I can put a check for that into the heuristic about when to use threads. And/or use a smaller stack per thread - currently that isn't tuned, so if this is many users, tight limits but lots of cores, it may be also that we need to consider the ram footprint in assessing the thread count.

Another thing we could do is handle memory allocation errors by letting IO complete and retrying; though I'd rather not be bouncing right off of the limits since that often means you're already into swap and the point here is to be avoiding slowness not causing it :).

Lastly, are you able to build a rust hello world project with cargo in release mode in that shell server?- cargo init --binary + cargo build --release or something similar.

@grebnetiew
Copy link

grebnetiew commented Jun 7, 2019

Some testing on Windows 10 here (1903 18362). Compiling the retry package failed on the compiler I had installed, which had not been updated since December, but it works with warnings after an update:

Compiler warning at cargo build --release
 Erik7 > C:\Users\Erik\rustup.rs > rustup show
Default host: x86_64-pc-windows-msvc

installed toolchains
--------------------
beta-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc

active toolchain
----------------
beta-x86_64-pc-windows-msvc (default)
rustc 1.36.0-beta.3 (0ff088c9e 2019-05-29)

 Erik7 > C:\Users\Erik\rustup.rs > cargo build --release
( ... many lines omitted ... )
  Compiling download v0.6.2 (C:\Users\Erik\rustup.rs\download)
warning: the item `OsString` is imported redundantly
   --> src\utils\utils.rs:614:9
    |
7   | use std::ffi::OsString;
    |     ------------------ the item `OsString` is already imported here
...
614 |     use std::ffi::OsString;
    |         ^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unused_imports)] on by default

Then, the actual results:

target\release\rustup.exe install nightly
 Erik7 > C:\Users\Erik\rustup.rs > target\release\rustup.exe install nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 60.3 MiB /  60.3 MiB (100 %)   5.1 MiB/s in 12s ETA:  0s
info: downloading component 'rust-std'
 55.8 MiB /  55.8 MiB (100 %)   4.9 MiB/s in 11s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   5.1 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 60.3 MiB /  60.3 MiB (100 %)  13.7 MiB/s in  4s ETA:  0s
info: installing component 'rust-std'
 55.8 MiB /  55.8 MiB (100 %)  15.1 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   1.2 MiB/s in  7s ETA:  0s

For comparison, with the built-in rustup:

rustup install nightly
 Erik7 > C:\Users\Erik\rustup.rs > rustup install nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 60.3 MiB /  60.3 MiB (100 %)   4.6 MiB/s in 12s ETA:  0s
info: downloading component 'rust-std'
 55.8 MiB /  55.8 MiB (100 %)   4.8 MiB/s in 11s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   4.9 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 60.3 MiB /  60.3 MiB (100 %)  13.3 MiB/s in  4s ETA:  0s
info: installing component 'rust-std'
 55.8 MiB /  55.8 MiB (100 %)  14.7 MiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %)   1.0 MiB/s in  8s ETA:  0s

So it looks to be about the same here. Let me know if you'd like me to try anything else.

@passcod
Copy link

passcod commented Jun 7, 2019

On a tiny aarch64 device, 4 cores with 1GB memory, writing to an SD card. Anecdote: while compiling the branch, I experimented with cooling... I ended up sticking the entire board in a jar of oil, and that let me finish the build.

Stable (1:39)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  20.4 MiB/s in 10s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  21.0 MiB/s in  7s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   1.2 MiB/s in 24s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   5.5 MiB/s in 25s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   3.9 MiB/s in 28s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:38.83 real,   31.06 user,     5.65 sys
29476 max mem,  14584 inputs,   1195720 outputs
was: $ rustup install nightly
Simple run (1:32)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  20.2 MiB/s in  9s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  19.8 MiB/s in  7s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.6 MiB/s in 14s ETA:  0s
  3 iops /   3 iops (100 %)   0 iops/s in 15s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   5.0 MiB/s in 22s ETA:  0s
  9 iops /   9 iops (100 %)   0 iops/s in 10s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   3.9 MiB/s in  7s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:31.75 real,   32.81 user,     5.78 sys
337072 max mem, 312 inputs,     1195704 outputs
was: $ ./rustup install nightly
IO threads disabled (2:06)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  19.6 MiB/s in  9s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  20.1 MiB/s in  7s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.3 MiB/s in 28s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   4.3 MiB/s in 27s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   3.8 MiB/s in  3s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

2:06.49 real,   32.28 user,     5.94 sys
196704 max mem, 0 inputs,       1195704 outputs
was: $ env RUSTUP_IO_THREADS=disabled ./rustup install nightly
IO threads = 1 (1:50)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  19.3 MiB/s in  8s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  20.3 MiB/s in  8s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.6 MiB/s in 14s ETA:  0s
  6 iops /   6 iops (100 %)   0 iops/s in  4s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   5.3 MiB/s in 24s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   3.9 MiB/s in 39s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:50.14 real,   32.67 user,     5.99 sys
335116 max mem, 88 inputs,      1195704 outputs
was: $ env RUSTUP_IO_THREADS=1 ./rustup install nightly
IO threads = 2 (1:32)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  20.2 MiB/s in  8s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  20.4 MiB/s in  8s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.6 MiB/s in 14s ETA:  0s
  7 iops /   7 iops (100 %)   1 iops/s in 15s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   2.4 MiB/s in 26s ETA:  0s
  7 iops /   7 iops (100 %)   2 iops/s in  3s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   3.9 MiB/s in 12s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:32.33 real,   32.65 user,     5.83 sys
335504 max mem, 112 inputs,     1195704 outputs
was: $ env RUSTUP_IO_THREADS=2 ./rustup install nightly
IO threads = 3 (1:54)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  20.0 MiB/s in  8s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  20.6 MiB/s in  8s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.6 MiB/s in 14s ETA:  0s
  3 iops /   3 iops (100 %)   0 iops/s in 18s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   3.2 MiB/s in 15s ETA:  0s
  8 iops /   8 iops (100 %)   0 iops/s in  5s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   4.0 MiB/s in 37s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:54.08 real,   32.85 user,     5.73 sys
335732 max mem, 184 inputs,     1195704 outputs
was: $ env RUSTUP_IO_THREADS=3 ./rustup install nightly
IO threads = 4 (1:30)
info: syncing channel updates for 'nightly-aarch64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)  20.2 MiB/s in  9s ETA:  0s
info: downloading component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)  19.5 MiB/s in  7s ETA:  0s
info: downloading component 'cargo'
info: installing component 'rustc'
 67.2 MiB /  67.2 MiB (100 %)   3.6 MiB/s in 14s ETA:  0s
  3 iops /   3 iops (100 %)   0 iops/s in 16s ETA:  0s
info: installing component 'rust-std'
 64.6 MiB /  64.6 MiB (100 %)   5.0 MiB/s in 23s ETA:  0s
  9 iops /   9 iops (100 %)   0 iops/s in  8s ETA:  0s
info: installing component 'cargo'
  4.0 MiB /   4.0 MiB (100 %)   4.0 MiB/s in  7s ETA:  0s

  nightly-aarch64-unknown-linux-gnu installed - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

info: checking for self-updates

1:30.79 real,   32.92 user,     5.72 sys
337216 max mem, 40 inputs,      1195704 outputs
was: $ env RUSTUP_IO_THREADS=4 ./rustup install nightly

@lnicola
Copy link
Member

lnicola commented Jun 7, 2019

@passcod woah you don't have rust-docs?

@passcod
Copy link

passcod commented Jun 7, 2019

Not available for this platform, I guess?

@enizor
Copy link

enizor commented Jun 7, 2019

On Windows 10:
Same warning as stated above. rust-doc improved from 39s to 31s

On WSL(ubuntu):
rust-doc improved from 2m5s to 1m52s

@Coder-256
Copy link

Coder-256 commented Jun 7, 2019

@rbtcollins About WslFs, I'm not 100% sure but I think it actually refers to how the virtual linux FS is stored. I gave it a try, and I wish I had taken a benchmark before, but after the (VERY LONG) upgrade process wsl.exe --upgrade ubuntu, here's what I got today:

Rustup output
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-07, rust version 1.37.0-nightly (5eeb567a2 2019-06-06)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  24.3 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)  32.6 MiB/s in  1s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-src'
info: downloading component 'rust-analysis'
info: removing component 'rustc'
info: removing component 'rust-std'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: removing component 'rust-src'
info: removing component 'rust-analysis'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  13.2 MiB/s in  9s ETA:  0s
info: installing component 'rust-std'
 61.7 MiB /  61.7 MiB (100 %)  15.0 MiB/s in  4s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 352.0 KiB/s in 14s ETA:  0s
info: installing component 'rust-src'
  2.5 MiB /   2.5 MiB (100 %)   2.4 MiB/s in  6s ETA:  0s
info: installing component 'rust-analysis'
info: checking for self-updates

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.35.0 (3c235d560 2019-05-20)
    beta-x86_64-unknown-linux-gnu unchanged - rustc 1.36.0-beta.3 (0ff088c9e 2019-05-29)
   nightly-x86_64-unknown-linux-gnu updated - rustc 1.37.0-nightly (5eeb567a2 2019-06-06)

Edit: Using Windows 1903 (on Bootcamp on a MacBook Pro)

@rbtcollins
Copy link
Contributor Author

@Coder-256 I wish it was :) - Just coincidentally the MS Defender team have released signature updates about now hinting to defender how to deal with rustup under WSL similarly to rustup on Windows (scan on read rather than scan on close) - this has massively reduced the duration of the CloseHandle syscall and that improves performance the same as it did creating a manual Defender exclusion.

Current rustup in my not upgraded WSLv1:

 11.2 MiB /  11.2 MiB (100 %) 329.6 KiB/s in 27s ETA:  0s

This patch:

 11.2 MiB /  11.2 MiB (100 %) 132.8 KiB/s in 20s ETA:  0s

Three days ago, nothing else changed except defender signature updates...

 11.2 MiB /  11.2 MiB (100 %) 419.2 KiB/s in  2m 50s ETA:  0s

@Walther
Copy link

Walther commented Jun 9, 2019

Here's more info:

your memory rlimits - both hard and soft

prlimit
RESOURCE   DESCRIPTION                              SOFT        HARD UNITS
AS         address space limit                2147483648 68719476736 bytes
CORE       max core file size                          0   unlimited blocks
CPU        CPU time                            unlimited   unlimited seconds
DATA       max data size                      2147483648  6904709120 bytes
FSIZE      max file size                       unlimited   unlimited blocks
LOCKS      max number of file locks held       unlimited   unlimited
MEMLOCK    max locked-in-memory address space      65536   268447744 bytes
MSGQUEUE   max bytes in POSIX mqueues             819200      819200 bytes
NICE       max nice prio allowed to raise              0           0
NOFILE     max number of open files                 1024        1024
NPROC      max number of processes                   300         300
RSS        max resident set size               unlimited   unlimited pages
RTPRIO     max real-time priority                      0           0
RTTIME     timeout for real-time tasks         unlimited   unlimited microsecs
SIGPENDING max number of pending signals          580043      580043
STACK      max stack size                        8388608   unlimited bytes

cpu count being reported to rust?

2x Intel 6-Core Xeon 3,07 GHz, 24 cores total listed in /proc/cpuinfo and htop. 144 GB ECC total. It's a HP DL 360 G7.

Here's a bunch of logs with various thread number settings, some successful, some with crashes:

RUSTUP_IO_THREADS=disabled ./rustup
install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  35.2 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  29.5 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   6.5 MiB/s in 13s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)   8.1 MiB/s in 11s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 384.0 KiB/s in  1m 17s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
RUSTUP_IO_THREADS=1 ./rustup install
 nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  31.4 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  33.9 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   8.3 MiB/s in  9s ETA:  0s
  6 iops /   6 iops (100 %)   0 iops/s in  1s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  10.3 MiB/s in  6s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 536.0 KiB/s in  1m  8s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
RUSTUP_IO_THREADS=16 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  27.0 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  28.8 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   8.9 MiB/s in  8s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  10.8 MiB/s in  6s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 515.2 KiB/s in  1m  0s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
RUSTUP_IO_THREADS=24 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  33.0 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  30.7 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 4227040 bytes failedzsh: abort      RUSTUP_IO_THREADS=24 ./rustup install nightly
RUSTUP_IO_THREADS=20 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  70.5 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 81.6 MiB /  86.4 MiB ( 94 %)   9.7 MiB/s in  8s ETA:  0smemory allocation of 160949920 bytes failedzsh: abort      RUSTUP_IO_THREADS=20 ./rustup install nightly
RUSTUP_IO_THREADS=18 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  81.7 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   8.7 MiB/s in  8s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  11.4 MiB/s in  5s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 568.0 KiB/s in 53s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
RUSTUP_IO_THREADS=19 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  33.1 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  28.8 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 84.8 MiB /  86.4 MiB ( 98 %)   8.3 MiB/s in  9s ETA:  0smemory allocation of 160949920 bytes failedzsh: abort      RUSTUP_IO_THREADS=19 ./rustup install nightly
RUSTUP_IO_THREADS=18 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  78.7 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   9.0 MiB/s in  8s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  11.2 MiB/s in  5s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 329.6 KiB/s in 50s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
# intentionally running once with the stable rustup _not_ built from this branch
rustup --version
rustup 1.18.3 (435397f48 2019-05-22)
rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-08, rust version 1.37.0-nightly (d132f544f 2019-06-07)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  33.3 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)  28.1 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   5.8 MiB/s in 13s ETA:  0s
info: installing component 'rust-std'
 61.5 MiB /  61.5 MiB (100 %)   8.3 MiB/s in  9s ETA:  0s
info: installing component 'cargo'
  4.6 MiB /   4.6 MiB (100 %)   4.3 MiB/s in  1s ETA:  0s
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 456.0 KiB/s in  2m 26s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (d132f544f 2019-06-07)

info: checking for self-updates
rustup install nightly  22.31s user 12.65s system 15% cpu 3:41.93 total

TL;DR: with the flags (threadcount <=18) , I was able to install nightly with this branch's rustup. Interestingly, even with the flag RUSTUP_IO_THREADS=disabled this branch was about 50% faster at rust-docs than the stable rustup 1.18.3 (435397f 2019-05-22).

Lastly, are you able to build a rust hello world project with cargo in release mode in that shell server?- cargo init --binary + cargo build --release or something similar.

Yes - I built rustup from this branch on the server too. Additionally, just in case:

cargo +nightly run --release
   Compiling hellotest v0.1.0 (/home/6/walther/hellotest)
    Finished release [optimized] target(s) in 1.38s
     Running `target/release/hellotest`
Hello, world!

@rbtcollins
Copy link
Contributor Author

@Walther great thank you; the speed up is likely the removal of post-unpack chmodding: instead we set mode appropriately during unpack, which on systems with pagecache pressure will avoid paging the dentries and inodes back in after the unpack. (Some page-in is required to move into place, but many sub trees are moved as units, so still quite a saving).

Well we certainly aren't hitting 2G of memory, so hmm I'm not sure how to auto-detect a reasonable threshold; those last 6 threads seem to cause the issue; that raises memory pressure two-fold: more concurrent IO requests with their buffers on the heap - so 6 more threads is up to 6 potentially large files (you are crashing on a 160MB file); as well as 6* the thread stack size, which I'm guessing is defaulting to 8MB so 48MB.

Can you do a test and alloc in a loop until you get a failure - how much ram does a process get?

@Walther
Copy link

Walther commented Jun 9, 2019

Haven't dealt with straight memory allocation in Rust yet, so here's a short naive snippet I used:

fn main() {
    let mut growing: Vec<_> = Vec::new();
    for i in 1..1000 {
        let million = vec![1; 1_000_000];
        growing.push(million);
        println!("{} M of Vec the wall", i);
    }
}
...snip
530 M of Vec the wall
531 M of Vec the wall
532 M of Vec the wall
533 M of Vec the wall
memory allocation of 4000000 bytes failedzsh: abort      cargo run --release

With a handful of runs, seemed to stall at the same spot of the loop.

@rbtcollins
Copy link
Contributor Author

rbtcollins commented Jun 9, 2019

@Walther can you try with 24 threads and RUST_MIN_STACK=1048576‬ ? Similar for 2097152
If that works, please try 48 likewise.

I have some future work planned to dynamically add/remove threads which may help here, but setting a thread stack size explicitly may be a simple first step. you only have 21MB per CPU, and if that limit is per process rather than per process group..

Hmm, its interesting that the RSS rlimit isn't set but we're still hitting a limit. Do you know if its cgroups or ??

@Walther
Copy link

Walther commented Jun 11, 2019

No luck with those parameters. This seems fairly odd, considering the compilation of rustup itself from this branch worked perfectly fine 🤔 I'd assume the cargo build --release uses a fair amount of threads and subsequently RAM, for compiling all the dependencies etc.

RUST_MIN_STACK=1048576 RUSTUP_IO_THREADS=24 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  30.9 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 61.8 MiB /  61.8 MiB (100 %)  25.3 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 11.0 MiB /  86.4 MiB ( 13 %)   0 B/s in  1s ETA: Unknownmemory allocation of 52184320 bytes failedzsh: abort      RUST_MIN_STACK=1048576 RUSTUP_IO_THREADS=24 ./rustup install nightly
RUST_MIN_STACK=1048576 RUSTUP_IO_THREADS=24 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 13.3 MiB /  86.4 MiB ( 15 %)   0 B/s in  1s ETA: Unknownmemory allocation of 52184320 bytes failedzsh: abort      RUST_MIN_STACK=1048576 RUSTUP_IO_THREADS=24 ./rustup install nightly
 RUST_MIN_STACK=2097152 RUSTUP_IO_THREADS=24 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  73.2 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 12341488 bytes failedzsh: abort      RUST_MIN_STACK=2097152 RUSTUP_IO_THREADS=24 ./rustup install nightly
RUST_MIN_STACK=2097152 RUSTUP_IO_THREADS=24 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  71.6 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
memory allocation of 12341488 bytes failedzsh: abort      RUST_MIN_STACK=2097152 RUSTUP_IO_THREADS=24 ./rustup install nightly

Edit ref. discord chat

With min-stack 1M, worked with 19 threads (new record! :D)

RUSTUP_IO_THREADS=19 RUST_MIN_STACK=1048576 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  72.0 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   9.1 MiB/s in  8s ETA:  0s
info: installing component 'rust-std'
 61.8 MiB /  61.8 MiB (100 %)  10.5 MiB/s in  6s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 572.8 KiB/s in 47s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (02564de47 2019-06-10)

info: checking for self-updates
# still fails with 24
RUSTUP_IO_THREADS=24 RUST_MIN_STACK=1048576 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  26.4 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 61.8 MiB /  61.8 MiB (100 %)  35.8 MiB/s in  2s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 12.3 MiB /  86.4 MiB ( 14 %)   0 B/s in  1s ETA: Unknownmemory allocation of 52184320 bytes failedzsh: abort      RUSTUP_IO_THREADS=24 RUST_MIN_STACK=1048576 ./rustup install nightly
# and 20 fails too
RUSTUP_IO_THREADS=20 RUST_MIN_STACK=1048576 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  72.0 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 80.0 MiB /  86.4 MiB ( 93 %)   9.4 MiB/s in  8s ETA:  0smemory allocation of 160949920 bytes failedzsh: abort      RUSTUP_IO_THREADS=20 RUST_MIN_STACK=1048576 ./rustup install nightly
# re-run, yup works with 19 threads and 1m stack
RUSTUP_IO_THREADS=19 RUST_MIN_STACK=1048576 ./rustup install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-06-11, rust version 1.37.0-nightly (02564de47 2019-06-10)
info: downloading component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)  78.0 MiB/s in  1s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 86.4 MiB /  86.4 MiB (100 %)   7.6 MiB/s in  9s ETA:  0s
info: installing component 'rust-std'
 61.8 MiB /  61.8 MiB (100 %)  11.3 MiB/s in  5s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.2 MiB /  11.2 MiB (100 %) 336.0 KiB/s in 47s ETA:  0s

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.37.0-nightly (02564de47 2019-06-10)

info: checking for self-updates

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few tiny niggles, which I'm mostly happy to receive pushback on, otherwise 👍 This looks awesome.

src/diskio/immediate.rs Outdated Show resolved Hide resolved
item.finish = precise_time_s();
}

#[allow(unused_variables)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than unused variables (which I assume is mode on Windows) could we not check mode against 0644/0755 and return an error if the mode is bad as part of our tar verification plans?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest rust can do attributes on parameters. Yay. But no, wrong later. push back here. I can call it _mode instead if you prefer to have it narrow; alex didn't like that in tar-rs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine for it to stay like this for now.

println!("{} deferred IO operations", prev_files);
}
let buf: Vec<u8> = vec![0; prev_files];
assert!(32767 > prev_files);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This magic number here -- could it be a named constant just to make it clearer what it's up to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment is better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay seems fair to me for now. Clear what to do if the assert fires, so good comment.

src/dist/component/package.rs Outdated Show resolved Hide resolved
@kinnison
Copy link
Contributor

As an aside, I think the appveyor failure is spurious -- appveyor has been being more and more unreliable. In comparison, my tests on Travis/Windows have been 100% good. (I broke Travis once, but otherwise no strange link errors etc)

When directories complete, start writing the files/dirs within
that directory that have been decompressed already.

Avoids a stat() + create_dir_all() in the main thread permitting
more concurrent IO dispatch in exchange for memory pressure.
Heavily deferred directories can lead to very large amounts of RAM
holding pending IOs, and under low memory limits this caused failures.

Reduce the stack size for IO worker threads to 1MB, as the default
of 8MB on Linux is wasteful for IO worker threads.
item.finish = precise_time_s();
}

#[allow(unused_variables)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine for it to stay like this for now.

println!("{} deferred IO operations", prev_files);
}
let buf: Vec<u8> = vec![0; prev_files];
assert!(32767 > prev_files);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay seems fair to me for now. Clear what to do if the assert fires, so good comment.

@kinnison kinnison merged commit 9511fef into rust-lang:master Jun 15, 2019
@bors bors mentioned this pull request Jun 15, 2019
@rbtcollins rbtcollins deleted the bug-1866 branch March 13, 2021 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants