Open Bug 2037750 Opened 3 months ago Updated 2 months ago

Investigate disabling content process prespawning in Felt

Categories

(Enterprise Products :: Firefox, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: gerard-majax, Assigned: gerard-majax)

References

(Blocks 1 open bug)

Details

Currently, when running Felt, there is no specific locking down of content process (pre)spawning. We should look into that:

  • profile to check the current situation, but from some profile I already did, we may be pre-spawing 4 content processes
  • adjust the number of content processes to what is really meaningful for the SSO flow (one private content process should be enough)
  • disable extra-pre spawning of processes
Assignee: nobody → lissyx+mozillians

State before any change: https://share.firefox.dev/4aWMMOL

Measuring:

pgrep -f "obj-felt-extension-dbg/dist/bin/firefox" | while read pid; do
  awk '/^Pss:/{sum+=$2} END{print sum}' /proc/$pid/smaps_rollup 2>/dev/null
done | awk '{sum+=$1} END{printf "Total PSS: %.1f MB\n", sum/1024}'

STR; mach run on a debug build, enter an email, stop at the first Auth0 SSO page. Wait ~20s

No change:

$ for i in $(seq 60); do pgrep -f "obj-felt-extension-dbg/dist/bin/firefox" | while read pid; do   awk '/^Pss:/{sum+=$2} END{print sum}' /proc/$pid/smaps_rollup 2>/dev/null; done | awk '{sum+=$1} END{printf "Total PSS: %.1f MB\n", sum/1024}'; sleep 1; done;
Total PSS: 321.9 MB
Total PSS: 321.9 MB
Total PSS: 322.0 MB
Total PSS: 357.0 MB
Total PSS: 380.5 MB
Total PSS: 376.4 MB
Total PSS: 375.5 MB
Total PSS: 374.2 MB
Total PSS: 363.0 MB
Total PSS: 364.3 MB
Total PSS: 363.2 MB
Total PSS: 363.4 MB
Total PSS: 363.5 MB
Total PSS: 365.9 MB
Total PSS: 362.0 MB
Total PSS: 361.1 MB
Total PSS: 359.8 MB
Total PSS: 361.6 MB
Total PSS: 359.7 MB
Total PSS: 359.3 MB
Total PSS: 360.0 MB
Total PSS: 359.5 MB
Total PSS: 358.5 MB
Total PSS: 358.5 MB
Total PSS: 358.5 MB
Total PSS: 358.5 MB
Total PSS: 358.5 MB
Total PSS: 357.0 MB

I'm getting very similar values with:

diff --git a/browser/extensions/felt/api.js b/browser/extensions/felt/api.js
index 312fbefa37273..61855623470bb 100644
--- a/browser/extensions/felt/api.js
+++ b/browser/extensions/felt/api.js
@@ -256,6 +256,12 @@ this.felt = class extends ExtensionAPI {
       // their main thread demoted to low-priority QoS, which can starve the
       // SSO callback's DOMContentLoaded event and prevent token extraction.
       Services.prefs.setBoolPref("threads.use_low_power.enabled", false);
+
+      Services.prefs.setIntPref("dom.ipc.processPrelaunch.fission.number", 0);
+      Services.prefs.setIntPref("dom.ipc.processCount.file", 0);
+      Services.prefs.setIntPref("dom.ipc.processCount", 2);
+      Services.prefs.setBoolPref("media.rdd-process-prelaunch.enabled", false);
+
       this.registerChrome();
       await this.registerActors();
       await lazy.FeltStorage.init();
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index 116737c211900..a9a8561da872c 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3030,7 +3030,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {

   gpm->AddListener(this);

-  if (StaticPrefs::media_rdd_process_enabled()) {
+  if (StaticPrefs::media_rdd_process_enabled() && StaticPrefs::media_rdd_process_prelaunch_enabled()) {
     // Ensure the RDD process has been started.
     RDDProcessManager* rdd = RDDProcessManager::Get();
     rdd->LaunchRDDProcess();
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ba6387c2437aa..750a2058ba2e5 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -12368,6 +12368,12 @@
 #endif
   mirror: always

+
+- name: media.rdd-process-prelaunch.enabled
+  type: RelaxedAtomicBool
+  value: true
+  mirror: always
+
 - name: media.rdd-retryonfailure.enabled
   type: RelaxedAtomicBool
   value: true

Maybe debug builds are not a good fit ...

You need to log in before you can comment on or make changes to this bug.