Open Bug 1913797 Opened 2 years ago Updated 3 months ago

Consider using auto-scaling for TaskController thread pool

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

People

(Reporter: tcampbell, Assigned: tcampbell, NeedInfo)

References

Details

The TaskController makes a decision at startup about how many background threads to use for work. There are a variety of tuning heuristics that we have used for this. In practice, we find that an unlimited number of threads doesn't actually provide better performance in the face of CPU frequency scaling, SMT, heterogeneous architectures, or memory cache hierarchies.

We have seen performance improvements by limiting number of threads, but at the same time it is hard to generalize this to all workloads. This bug is about dynamically adjusting the number of concurrent threads we use in the TaskController based time-varying data on recent execution behaviour.

The simple model I'm starting with is computing average recent concurrent workload and only scaling up number of available threads when we consistently make high use of current threads. This is believed to encourage latency sensible concurrent work (not to be confused with low-priority background work) to run on bigger cores at higher clocks and with more relevant data in caches.

See Also: → 1903039

For reference, at the other end of the spectrum for threading, I've been using the Unity WASM demo ( https://beta.unity3d.com/jonas/AngryBots/ ) as something that benefits from many cores.

I'll clean up my prototype and run more benchmarks, but at a first approximation the approach seems to work to keep speedometer at 2 cores (on my machine) with wasm compiles quickly scaling up to much higher parallelism than simply restricting core count.

Hi! I stumbled over this while looking at how we can reduce the number of threads across processes. Are you still planning to do something here? I'd assume an inverse heuristics to downscale the number of threads could also be feasible then?

Flags: needinfo?(tcampbell)
See Also: → 1910208
You need to log in before you can comment on or make changes to this bug.