Web app resource usage - separate processes? - performance and efficiency implications

Obligatory I have absolutely no clue what I am doing so all of this could be wrong.
Part of the utility of web app integration is that it doesn’t require running additional instances of a browser (like electron). This is wasteful of resources when all tabs and web apps could be run from one browser instance while still appearing as separate apps.
I ran a little experiment with GNOME Web/Epiphany where I opened bitwarden login pages and observed the system monitor.

When two tabs were open, there was one process named epiphany. When I opened the second tab in its own window, there was still only one process and no significant change in resources. But when I opened the same page as a web app (and closed one of the windows, so still 2 instances), there was an additional ‘epiphany’ process, and usage of CPU and memory was significantly increased.

Correct me if I am mistaken, but if the web app was running under the same browser instance, there wouldn’t be a significant difference between opening it in another window and in an “app” window?

I am not yet reporting this as a bug because this might just be how it was implemented. If so, the only option for same-instance web apps might be Chromium-based browsers, since FirefoxForPWAs literally uses a separate binary and effectively runs each app in its own instance too.

On battery or performance limited devices, this can be a potent disadvantage. Browser instances, on Linux and Windows, chromium-based (including electron), gecko, and webkit, eat up massive amounts of battery. I can strech to 8 or more hours running only truly native apps, but if I have a single web instance open, it reduces to 5.

It is not the same browser instance. Each web app instance is entirely isolated. I don’t think there’s any way to get the behavior you want. I would recommend just not using the web apps feature at all if you don’t want them to be isolated from each other.

Idle web apps should not be using your CPU, but yes, any app using CPU will certainly reduce your battery life, possibly drastically.

Regarding memory use, I don’t think isolation at the app level will make much difference. Even if you load everything in the same browser instance, you’re still going to wind up with separate web processes for every tab. In fact, we don’t have enough isolation currently; see here for what we should be doing and here for practical consequences of the current model. But also, WebKit is designed to cache as much as possible until it has filled up your system RAM, so memory use is going to look bad no matter what. It won’t evict caches until you have nearly exhausted your total RAM. I recently learned this includes unused web processes, which will be kept around for half an hour after last use, all just to make loading that next web page a little faster. This should actually help your battery life though, because anything that is cached does not need to be computed or downloaded again.

When two tabs were open, there was one process named epiphany. When I opened the second tab in its own window, there was still only one process and no significant change in resources.

I think you maybe just did not notice the new process? WebKit needs a minimum of one web process per tab. There will also be cached processes from previous navigations ready to be used for future loads for the same origin, and one prewarmed process ready to load a new origin. Plus the network process, an xdg-dbus-proxy for each tab, and either bwrap or flatpak-spawn processes monitoring their web processes. It’s kind of a lot.

We don’t expose single web process mode anymore because it is no longer considered secure.

Thwnk you for the clarification. I am glad I was wrong. Best wishes.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.