NSS should be initialized off main thread
Categories
(Core :: Security: PSM, enhancement, P2)
Tracking
()
| Performance Impact | medium |
People
(Reporter: florian, Unassigned)
References
(Depends on 2 open bugs, Blocks 6 open bugs)
Details
(Keywords: perf:responsiveness, perf:startup, Whiteboard: [psm-blocked][bhr:nsNSSComponent::InitializeNSS])
| Reporter | ||
Comment 1•9 years ago
|
||
Updated•9 years ago
|
Comment 2•9 years ago
|
||
Updated•9 years ago
|
Updated•8 years ago
|
Comment 3•8 years ago
|
||
Comment 5•8 years ago
•
|
||
Updated•8 years ago
|
Comment 6•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
Updated•8 years ago
|
Updated•7 years ago
|
Comment 9•7 years ago
|
||
Marking P2 for investigation because the last comment from keeler is that to move forward we need more information about exactly what is slow about NSS initialization
| Reporter | ||
Comment 10•7 years ago
|
||
Here are two profiles showing what happens during NSS initialization: https://perfht.ml/2G4F0pl https://perfht.ml/2G4Mw3x
| Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 11•5 years ago
|
||
We're seeing this on Fenix startup profiles, about 100ms (with profiler) on a Moto G5
Comment 12•4 years ago
|
||
Raising the priority of this, this is still showing up frequently on BHR, combined with startup profiles on Fenix this seems like it could be a real win. Florian, if you believe I'm overstating the value here please correct me.
Updated•4 years ago
|
Comment 13•4 years ago
|
||
So, on Windows it seems like the primary cost here is just loading two dlls? Have we experimented with just loading those dlls in the background early during startup, as a safer win here?
The Android profile looks to be exhibiting a different problem - if I'm right then maybe we should split this into separate bugs.
Comment 14•4 years ago
|
||
(In reply to Doug Thayer [:dthayer] (he/him) from comment #13)
So, on Windows it seems like the primary cost here is just loading two dlls? Have we experimented with just loading those dlls in the background early during startup, as a safer win here?
It looks like there was an experiment along those lines a few years ago: bug 1640087. It looks like you were actually involved - do you know the outcome of that?
Comment 15•4 years ago
|
||
Ack - I simply forgot that these dlls were involved in that experiment. Bug 1640087 was a really weird one. On every machine I could get my hands on with an HDD and not an SSD, it yielded an outstanding startup performance win, typically on the order of 15-25%. However in the wild the performance improvements evaporated, and we observed almost no difference, but with I believe a very very slight win on HDDs, but not enough to be significant. IIRC the modified list of dlls was experimented with locally across a range of machines to find the optimal set.
We never figured out why the performance differences evaporated - we checked and double checked the experiment and couldn't identify any problem. I certainly think it's time we clean up the set of dlls we prefetch, but it's hard to figure out what the proper list should be. I would lean toward going with what our local testing highlighted, even though the experiment flopped. Sorry I can't be more conclusive on this.
| Reporter | ||
Comment 16•4 years ago
|
||
(In reply to Doug Thayer [:dthayer] (he/him) from comment #15)
I certainly think it's time we clean up the set of dlls we prefetch, but it's hard to figure out what the proper list should be.
Couldn't we save during startup the order in which dll files are accessed (we record profiler markers for DLL loads, so it should be possible to also record the information into some other storage), so that at the next startup we pre-read these dll files off main thread? We already do something similar for non-dll files.
Comment 17•4 years ago
|
||
Right, but it's not actually clear to me that we get much out of that. Especially on Windows, where the OS is trying to prefetch files for us anyway.
Revising my recent take on this bug, has anyone actually been able to reproduce this problem on anything other than on one of our spinny disk reference machines? I can't get it to show up to any serious degree in profiling on any of my SSD machines. If it only shows up on slow spinny disk systems, then we need to be explicit that that is who would be affected, and I don't feel confident anymore that A) that hardware is a priority, since it is slowly dying out, or B) that the problem is even very tractable for them.
| Reporter | ||
Comment 18•4 years ago
|
||
(In reply to Doug Thayer [:dthayer] (he/him) from comment #17)
has anyone actually been able to reproduce this problem on anything other than on one of our spinny disk reference machines? I can't get it to show up to any serious degree in profiling on any of my SSD machines.
I haven't tried on machines with SSDs, but that now makes me wonder if we should include the information about whether there's an SSD as an annotation in BHR reports.
A) that hardware is a priority, since it is slowly dying out,
Do we have data about how quickly it's dying (or not dying) for our users? I think we still have lots of Windows 7 users, so that's likely users that haven't updated their machines in a while.
| Reporter | ||
Comment 19•4 years ago
|
||
(In reply to Florian Quèze [:florian] from comment #18)
Do we have data about how quickly it's dying (or not dying) for our users?
Answering my own question a bit: https://www.statista.com/statistics/285474/hdds-and-ssds-in-pcs-global-shipments-2012-2017/ shows that in new machines, SSDs became the majority only in 2021, with 52% of disks shipped in 2021 being SSD. It seems Microsoft would like all new Windows 11 PCs to have SSDs in 2023, but it's unclear if it will actually happen as there's some pushback from the industry.
I think we still have lots of Windows 7 users, so that's likely users that haven't updated their machines in a while.
17% of our users are still running Windows 7, according to https://data.firefox.com/dashboard/hardware
Comment 20•4 years ago
|
||
It's still just questionable to me that the problem is even tractable for HDD users. Again, Windows is trying to prefetch files off disk anyway, and this behavior varies from OS version to OS version, so we would have to experiment across a range of drives across a range of OS versions and fundamentally we're working with less information and less expertise than the OS has.
Comment 21•3 years ago
|
||
The Performance Priority Calculator has determined this bug's performance priority to be P2. If you'd like to request re-triage, you can reset the Performance flag to "?" or needinfo the triage sheriff.
Platforms: [x] Windows [x] macOS [x] Linux [x] Android
Impact on browser UI: Causes noticeable startup delay
Bug requires additional experimentation on HDD vs SDD. Clear actionable next steps are requested.
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•