Repository navigation
Feature : Affinity option for gathering several pages in a single process - #11501
Conversation
|
Regarding your concern about Node stability when having several instances in the same process, I agree, I did not investigate. The node bindings is called for each page not sure if the current design supports multiple instances. |
|
Very interested in this if it actually works 👍 |
| } else { | ||
| // We must not provide the url | ||
| // This site is "isolated" and must not be taken into account | ||
| // when Chromium looking at a candidat for an url. |
|
Hi,
Thanks |
|
I'm doing a rebase of this branch to fix the line endings problem (UNIX line ending was changed to DOS line ending). |
Our tests are a bit flaky, the failure was not related to your changes.
I think it is fine to not test it, we are already running multiple Node environments in one process (web workers, devtools extensions). |
|
Dos it mean this MR may be accepted soon ;-) |
|
I am happy that this got merged, but think the documentation should be more verbose as to what this means. E.g. can I share memory between 2 browser windows and now, can I access the DOM from the other window, how can I communicate between 2 windows? |
Great point! In other words, what are the practical applications of this feature? |
|
Even just adding some of the content from this PR to the docs would be helpful:
|
|
Useful feature. Any update on the aforementioned "verbose" documentation and "practical applications"? |
|
I have tried the affinity feature. I think it's very useful option to reduce memory usage. |
See #11484 (comment)
Add an "affinity" option for gathering several webpages in a single process.
Expected behavior
Chromium
We want to take advantage of the optional ability of Chromium to gather Web pages from the same site/domain in a single renderer process.
In a nutshell, you can have several pages hosted in the same renderer process (vs having a process per webpage).
Chromium process models
The mecanism can be fine-tuned and we can even decide which process will host which page (complying with the rule : a process can only manage webpages from the same site/domain).
It is promoted by OpenFin and intensively used by Thomson Reuters Eikon which embeds its own Chromium (CEF/C++)
Purpose is to save resources of the machine and prevent from reaching the limit of number of processes authorized by Chromium.
The challenge is to identify Web pages that can easily share the same process without being impacted too heavily by the performance of having a single process (have the same V8 engine, same thread, same messageLoop…) but this is another story.
Proposal
I would like to add an optional parameter affinity to the webPreferences of a BrowserWindow. This option identifies a renderer process (internally a Chromiun SiteInstance) candidate for hosting this page.
Known limitations
Some options are managed at process level (provided through the commandline) :
You can not mix in the same process, windows with such different options. The options of the process will be always applied.
Conclusion
The code changed is limited and does not impact usual workflow if the option is not set. I updated documentation and added unit tests.