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

Consider breaking up big Nexus 🔨 #1154

Open
Tracked by #1155
smklein opened this issue Jun 3, 2022 · 3 comments
Open
Tracked by #1155

Consider breaking up big Nexus 🔨 #1154

smklein opened this issue Jun 3, 2022 · 3 comments
Labels
build Building the control plane

Comments

@smklein
Copy link
Collaborator

smklein commented Jun 3, 2022

As @jgallagher helpfully showed during our weekly Rust study, cargo build --timings generates a nice report of build times.

From this report, there are some particularly bad offenders - among them, Nexus take 60+ seconds to compile.

By breaking Nexus into smaller crates, we could:

  1. Get better incremental compilation results - @cbiffle mentioned this was handy for Hubris folks
  2. Get better visibility in "what takes so long build". This could help us make further optimizations, and keep developer productivity high.
@smklein smklein added the build Building the control plane label Jun 3, 2022
@smklein
Copy link
Collaborator Author

smklein commented Jun 3, 2022

Using cargo rustc -p omicron-nexus --lib -- -Zself-profile, I generated an mm_profdata file which I passed to crox, using a --minimum-duration of 50000.

This generated a chrome_profiler.json file I've attached (Edit. I didn't attach it. Github is picky. Happy to help anyone reading along regenerate this though) - it can be loaded in chrome with chrome://tracing.

Lots of interesting stuff here:

  • Analysis + type checking takes ~20 seconds
  • Generating crate metadata takes ~10 seconds, most of that going to exported symbols (!)
  • Codegen takes another ~20 seconds

@smklein
Copy link
Collaborator Author

smklein commented Jun 3, 2022

This is a TL;DR of what it looks like to build the Nexus library on my machine, using the mold linker:

image

@ryaeng
Copy link
Contributor

ryaeng commented Jun 8, 2022

Sean, this looks interesting. My initial thoughts include breaking Nexus up into app, db, external_api, etc. Is that how you would approach this?

Also, I saw that monomorphization seems to be taking up a large chunk of time. Would we benefit from writing some of the larger functions from this...

fn add<T>(a: T, b: T) -> T where T: Add, { a + b }

to this...

fn add_usize(a: usize, b: usize) -> usize { a + b }

I don't have the vocabulary to be able to distinguish these two functions by name. If you could help me with the words used to differentiate these two, that would be most helpful. Thanks.

leftwo pushed a commit that referenced this issue Mar 4, 2024
Crucible changes:
Per client, queue-based backpressure (#1186)
A builder for the Downstairs Downstairs struct. (#1152)
Update Rust to v1.76.0 (#1153)
Deactivate the read only parent after a scrub (#1180)
Start byte-based backpressure earlier (#1179)
Tweak CI scripts to fix warnings (#1178)
Make `gw_ds_complete` less public (#1175)
Verify extent under repair is valid after copying files (#1159)
Remove individual panic setup, use global panic settings (#1174)
[smf] Use new zone network config service (#1096)
Move a few methods into downstairs (#1160)
Remove extra clone in upstairs read (#1163)
Make `crucible-downstairs` not depend on upstairs (#1165)
Update Rust crate rusqlite to 0.31 (#1171)
Update Rust crate reedline to 0.29.0 (#1170)
Update Rust crate clap to 4.5 (#1169)
Update Rust crate indicatif to 0.17.8 (#1168)
Update progenitor to bc0bb4b (#1164)
Do not 500 on snapshot delete for deleted region (#1162)
Drop jobs from Offline downstairs. (#1157)
`Mutex<Work>` → `Work` (#1156)
Added a contributing.md (#1158)
Remove ExtentFlushClose::source_downstairs (#1154)
Remove unnecessary mutexes from Downstairs (#1132)

Propolis changes:
PHD: improve Windows reliability (#651)
Update progenitor and omicron deps
Clean up VMM resource on server shutdown
Remove Inventory mechanism
Update vergen dependency
Properly handle pre/post illumos#16183 fixups
PHD: add `pfexec` to xtask phd-runner invocation (#647)
PHD: add Windows Server 2016 adapter & improve WS2016/2019 reliability (#646)
PHD: use `clap` for more `cargo xtask phd` args (#645)
PHD: several `cargo xtask phd` CLI fixes (#642)
PHD: Use ZFS clones for file-backed disks (#640)
PHD: improve ctrl-c handling (#634)
leftwo added a commit that referenced this issue Mar 4, 2024
Crucible changes:
Per client, queue-based backpressure (#1186)
A builder for the Downstairs Downstairs struct. (#1152) Update Rust to
v1.76.0 (#1153)
Deactivate the read only parent after a scrub (#1180) Start byte-based
backpressure earlier (#1179)
Tweak CI scripts to fix warnings (#1178)
Make `gw_ds_complete` less public (#1175)
Verify extent under repair is valid after copying files (#1159) Remove
individual panic setup, use global panic settings (#1174) [smf] Use new
zone network config service (#1096)
Move a few methods into downstairs (#1160)
Remove extra clone in upstairs read (#1163)
Make `crucible-downstairs` not depend on upstairs (#1165) Update Rust
crate rusqlite to 0.31 (#1171)
Update Rust crate reedline to 0.29.0 (#1170)
Update Rust crate clap to 4.5 (#1169)
Update Rust crate indicatif to 0.17.8 (#1168)
Update progenitor to bc0bb4b (#1164)
Do not 500 on snapshot delete for deleted region (#1162) Drop jobs from
Offline downstairs. (#1157)
`Mutex<Work>` → `Work` (#1156)
Added a contributing.md (#1158)
Remove ExtentFlushClose::source_downstairs (#1154) Remove unnecessary
mutexes from Downstairs (#1132)

Propolis changes:
PHD: improve Windows reliability (#651)
Update progenitor and omicron deps
Clean up VMM resource on server shutdown
Remove Inventory mechanism
Update vergen dependency
Properly handle pre/post illumos#16183 fixups
PHD: add `pfexec` to xtask phd-runner invocation (#647) PHD: add Windows
Server 2016 adapter & improve WS2016/2019 reliability (#646) PHD: use
`clap` for more `cargo xtask phd` args (#645) PHD: several `cargo xtask
phd` CLI fixes (#642)
PHD: Use ZFS clones for file-backed disks (#640)
PHD: improve ctrl-c handling (#634)

Co-authored-by: Alan Hanson <alan@oxide.computer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Building the control plane
Projects
None yet
Development

No branches or pull requests

2 participants