Workers can probably use the default maximum nursery size
Categories
(Core :: DOM: Workers, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: pbone, Assigned: pbone)
References
(Depends on 1 open bug)
Details
Attachments
(3 files)
Web workers set their maximum nursery size to a value lower than the default maximum nursery size. In some testing (with the JS shell) I found no difference. Note that this is the maximum size the nursery is allowed to grow to, not the current or initial nursery size. There's a good chance setting it specifically to a lower value has no impact at all, and we can remove this code.
I'll do more testing in the browser also.
Assignee | ||
Comment 1•5 years ago
|
||
Note that this basically reverts Bug 1037510. However that was landed before the nursery was good at using less memory / discarding its unused chunks properly and growing lazily.
Comment 2•5 years ago
|
||
I'd think carefully about doing this at a time when we are trying to reduce memory usage for fission. This would increase the possible max memory usage by 15MB, per worker, per process.
Comment 3•5 years ago
|
||
Do we have telemetry for in-the-wild Worker usage? (I know Paul said he did some testing in the shell but I'm curious how much memory Service Workers use, for example). I'm tentatively marking this as P3 but we can adjust as necessary.
Assignee | ||
Comment 4•5 years ago
|
||
It's important to remember that this is the maximum bound of how much memory may be used.
I've started some raptor, talos and awsy jobs to test it: https://treeherder.mozilla.org/#/jobs?repo=try&revision=99d4f5f450d434da3cbc3bd0ff3c189a6991046b
I don't see any telemetry for workers, or I didn't recognise it. I agree, it'd be nice to know before jumping in. Alternatively we can monitor the change in memory usage after the patch lands. OTOH if we don't have to increase this then why bother?
I have the feeling that the only reason people set the parameter to something other than the default is that is a parameter passed to JS_NewContext()
rather than one of the many parameters settable with JS_SetGCParameter()
.
Assignee | ||
Comment 6•5 years ago
|
||
This patch updates this for workers and worklets.
Depends on D47871
Comment 8•5 years ago
|
||
(In reply to Paul Bone [:pbone] from comment #4)
I've started some raptor, talos and awsy jobs to test it: https://treeherder.mozilla.org/#/jobs?repo=try&revision=99d4f5f450d434da3cbc3bd0ff3c189a6991046b
Do those tests use workers?
I have the feeling that the only reason people set the parameter to something other than the default is that is a parameter passed to
JS_NewContext()
rather than one of the many parameters settable withJS_SetGCParameter()
.
No, this was deliberate (see bug 1037510 or bug 1034611 comment 1).
Whether it's still applicable is another matter. Have you thought about how you might detect problems this change might cause?
Assignee | ||
Comment 9•5 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #8)
(In reply to Paul Bone [:pbone] from comment #4)
I've started some raptor, talos and awsy jobs to test it: https://treeherder.mozilla.org/#/jobs?repo=try&revision=99d4f5f450d434da3cbc3bd0ff3c189a6991046b
Do those tests use workers?
I hope so. These are all the performance and AWSY tests I know about. If they don't test workers then that's a pretty big omission.
I have the feeling that the only reason people set the parameter to something other than the default is that is a parameter passed to
JS_NewContext()
rather than one of the many parameters settable withJS_SetGCParameter()
.No, this was deliberate (see bug 1037510 or bug 1034611 comment 1).
Whether it's still applicable is another matter. Have you thought about how you might detect problems this change might cause?
In an extreme case we might see OOMs go up, but I doubt it. There are nursery size telemetry probes.. Oh but I'm not sure they work for workers.
Overholt had a good point that this has extra risk when we're specifically trying to drive down memory usage. I've decoupled it from Bug 1530251 (which was why I looked at it, to tidy up code related to that) so now it doesn't have to land. I want to defer to someone who knows about workers specifically whether we have telemetry on them and/or what tests exercise them. Baku what do you think? If you think this is a bad idea then then I don't want to land it and won't mind if you close the bug.
Comment 11•5 years ago
|
||
asuth for sure knows better than I. :D
Comment 13•5 years ago
|
||
We don't have nursery telemetry for workers or any other meaningful telemetry beyond when worker creation is deferred due to per-domain worker limits. Only the XPConnect XPCJSRuntime has JS telemetry hooks[1].
The platform makes some use of workers internally (specifically the still-JS based sessionstore) so there should be some coverage at minimum.
Given that this is altering the max, this seems reasonable to make workers behave more consistently with window globals.
Clearing baku's needinfo because baku is trying to get out of the workers game and already r+'d the patch.
1: https://searchfox.org/mozilla-central/rev/b6f088f2f68d2a8ae0b49d6c8fbd7cbd3a65fa5b/js/xpconnect/src/XPCJSRuntime.cpp#3081 hooks up
https://searchfox.org/mozilla-central/rev/b6f088f2f68d2a8ae0b49d6c8fbd7cbd3a65fa5b/js/xpconnect/src/XPCJSRuntime.cpp#2658
Assignee | ||
Comment 14•5 years ago
|
||
Thanks Andrew.
The benefit of this change is a fairly minor cleanup, but the risk is a regression we won't be able to monitor properly. I'm going to hold off on landing the patches for now.
Comment 15•5 years ago
|
||
Hi :pbone, can we now take a decision here? Just to not leave this open with an (aging) patch attached. Thank you!
Assignee | ||
Comment 16•5 years ago
|
||
Yeah, I want to land this. We can watch general telemetry to see if it increases memory usage (but I doubt it will) and I would like these things to be consistent, it'll make it easier to make future changes to how the nursery is configured.
Jonco, could you review the last patch?
Updated•5 years ago
|
Updated•5 years ago
|
Comment 17•5 years ago
|
||
Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7c86675ec7b2 Use the default max nursery size for workers in the shell r=jonco https://hg.mozilla.org/integration/autoland/rev/f0e49f75b1db Use the default max nursery size for workers r=baku,karlt https://hg.mozilla.org/integration/autoland/rev/d89e641acc9d Remove CycleCollectedJSContext::Initialize's nursery size param r=karlt
Assignee | ||
Updated•5 years ago
|
Comment 18•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7c86675ec7b2
https://hg.mozilla.org/mozilla-central/rev/f0e49f75b1db
https://hg.mozilla.org/mozilla-central/rev/d89e641acc9d
Description
•