Awn

Run multiple applets in one process

Registered by Michal Hruby

The goal of this blueprint is to reduce Awn's memory requirements by running multiple applets in one awn-applet process.

This is fairly trivial to do for C/Vala applets, as they are just dynamic libraries and we can open and run as many of them as we want in one process.
Of course danger of this approach is that one applet can and will crash all the others running in the same process, therefore I suggest adding "X-AwnStabilityGroup" key to applets' desktop files, which could contain for example one of values [high / medium / low] and according to this value we would either run the applet with others or run it in separate process (default).

The way to this would be implemented is by a "Launcher" DBus service awn-applet binary would provide, of course we'd need to do the same for python applets - or at least find a way to run python applets from C (which shouldn't be that hard).

One of the things we need to think about is applet removal - we need to make sure that applets clean up nicely when they're removed, otherwise removal of applet will most likely mean crash of the others - or we can just hide the applets and leave them running which would circumvent this problem.
Another problem is i18n, with the current architecture we won't be able to mix core and extras applets cause they expect different default translation domain.

Early tests I made indicate that memory savings by running the applets this way are quite big - when I ran related applet, quick-prefs, digital-clock and notification area in one process the process required only 4.4MB or RAM instead of about 11MB which was needed when each is run separately.
You can imagine the savings we could achieve if we manage to do the same with python applets where each requires 12-20MB. And moreover with python applets we don't need to be afraid of crashes so much since python will usually just throw an exception and we can continue running the other applets in the same process.

Blueprint information

Status:
Not started
Approver:
Awn-core
Priority:
Undefined
Drafter:
Michal Hruby
Direction:
Needs approval
Assignee:
Awn-core
Definition:
Discussion
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

onox [2010/05/13]: So.. Awn is going to target embedded.. eh.. desktops? :p But all jokes put aside, how big are the savings going to be for Python applets? Even if I kill all my Python applets here, I only save ~10M per applet; with < 10 applets, that's less than 100M; not too much for systems even a couple of years old. Of course, if the feature is completely transparent to the user and (python) applets cannot have any influence on other applets, then I've no objections. I would say that once this feature has become stable, all Python applets should run in one process (since exceptions can be caught), so that the X-AwnStabilityGroup only applies to C/Vala applets.

mhr3 [2010/05/13]: We obviously have different perceptions here, when running Awn with a few C applets in one process we can get *whole* Awn (panel + awn-applet process) to use about 10MB. That is quite a difference compared to 100MB. Also StabilityGroup applies also to python applets - see leaks in slickswitcher, some applets might not like threads used in weather etc.

onox [2010/05/14]: Ok, then it would indeed be better to have StabilityGroup for Python applets as well.

mhr3 [2010/05/22]: As I suspected memory savings are huge for python applets > take a look at http://imgur.com/pOuTk.png vs http://imgur.com/kDdnb.png (8 applets - 4 python, memory used: 80MB when running in 8 processes; everything in one process: 32.2MB). And the best thing is that adding more applets increases the memory usage by very small amounts.
Edit: Sorry I summed up also the core process, so -4.6MB for both numbers...

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.