Let the user decide if in doubt
Posted May 5, 2011
on:- In: KDE
- 113 Comments
(or: stop services that are not needed by any client)
If it comes to decisions there is always the aim to just do the right thing. In a lot of cases there is the one right thing. In quite a few cases there is no right thing but the consequences are small enough that it does not really matter which decision one takes. And then there are those use-cases where the only right thing to do is to ask the user because any other decision would just be guessing and lead to RAM and CPU wasting.
Yet even in the latter situations some apps are too lazy to ask the user or even claim that not asking the user – not even once – is the best solution – and even more astonishing: for the user’s good. So basically they claim to be smarter than the user or just do not care about the user’s resources or opinion.
Akonadi
In case akonadi is not running when the user starts kmail (and this example is only about that use-case) it asks the user whether it should start the service. That’s good! Tell the user that some needed service is missing and offer the means to start it. Give the user a choice instead of hiding processes. The user might have lost three seconds but he gained knowledge about a service that will consume a considerable amount of RAM and CPU-power. It’s not some small plasma or kded service!
Now if the user quits kmail akonadi will not quit automatically. Why not? Because it does not know whether it is still needed by other apps. As a result it consumes bandwith, RAM and CPU although it is not needed anymore. That’s bad! The fact that akonadi is not stopped when not needed anymore is another aspect where akonadi differs from some small plasma service that is started automatically (hidden) if the user adds the related widget. It is different because the latter also stops the service as automatically and hidden as it started it when the user removes it – thus there is no need to bother the user.
So why not simply ask the user in case of akonadi? Kmail asked the user whether to start the service, so why does it not ask whether it should stop it? If the user would want akonadi to run all the time he would autostart it with the session, would he not? And if kmail can ask the user to start akonadi why can those applications that still need it not do the same? What is wasting more resources and annoying a) to have akonadi in memory just in case there is some other app using it or b) let the user take a decision which takes two seconds? Worst case scenario would be that the application that needs akonadi tells the user to start it, as kmail did in the first place. Remember – if the user would want akonadi to run all the time he could start it as part of the session or click once on some “never quit akonadi” button.
Another approach would be to let kmail ask akonadi whether there are other applications using it. Either applications using it have to register with akonadi or respond to a “who needs me?” query by akonadi. That way the user could get a list of applications using akonadi and decide whether he wants to keep it in memory or not. He knows, the application just guesses or assumes. And it should only be the user that decides when it comes to a “do always”-kind of question. He might as well decide to “always quit akonadi when kmail quits” or “never quit akonadi when kmail quits” or “akonadi should quit as soon as there is no app answering to a ‘who needs me’ query”.
What makes it worse not to ask and just assume that staying in memory is ok is that there is no easy way to stop akonadi. There is no systray icon indicating its status and allowing interaction. There is no start/stop in systemsettings’ PIM module (as there is for e.g. nepomuk). There is no entry in systemsettings’ start/stop module. So even if the user knows about these systemsettings modules he cannot stop akonadi.
IMHO stopping something should be as easy and automatic as starting it. If that’s not the case it is an usability fail. I know that there is akonadictl but that is out of reach for most users and just underlines that stopping is not on the same level of ease as starting. The latter implies that once started the app thinks it is better not to be stopped again.
Lancelot
An even worse example is Lancelot. Adding a plasma widget starts an application without even asking or at least notifying the user. This would be kind of ok, if that application would be stopped as easy and automatically as it was started, as plasmoids can do, yet it is not!
Removing the widget lets lancelot stay in memory just in case there are other apps using it. According to the developer asking the user is out of question because it would involve user-interaction. So in the end you add a widget and remove it and yet have some useless app left wasting megabytes of memory, CPU-time and querying e.g. akonadi. There is no way to stop it via systemsettings. Yet the latter would not help anyway since the user does not even know that some memory/CPU wasting app was started without his knowledge int he first place.
Again wasting resources just in case there might be some app that needs the service is seen as the best way instead of simply asking the user. In times of suspending instead of rebooting and mobile devices this means that lancelot will happily waste your memory and CPU-time for ages although it is not needed at all. Simply because a three second user-interaction is considered bad by the developer. What makes people think that wasting their resources is less annoying to them than interacting with them once in a while?
And of course you are right to claim that nobody forces people to use e.g. Lancelot. Absolutely true! But that is just another reason to not pest those users with your application until they restart their session. They think they stopped everything as explicitly by removing the widget as they allegedly started it explicitly by adding the widget. Did we not all make fun of MS Windows because you had to restart it for all kinds of changes and when removing software?
So IMHO: If an application is not smart enough to know what the right thing to do is and whether it might waste RAM and CPU just for the sake of not interacting with the user – not even once: please ask the only expert regarding what the user wants – the user. Don’t try to be smarter than the user if the alternative is as easy as a single user-interaction. At an absolute minimum provide the user with the graphical means to stop whatever you thought necessary to start automatically but not stop automatically, e.g. via systemsettings as nepomuk does.
UPDATE: Since I seem to not have got that point across very well: I would also like to avoid questioning the user but that needs the service to behave as it was mentioned in some comments by others. As long as it does not do that, I prefer to decide what should be done with services that are not needed by any clients.
UPDATE 2: Since some people could not help themselves but simply claim that my figures on akonadi/kdepim’s memory consumption were wrong and would not even hint towards real memory consumption getting out of bounds, I’d like to point out that using /proc/PID/smaps one can measure the private dirty memory consumption of a process. In KDE’s system monitor you can reight-click a process and pick “detailed memory information” to get that info. So bottom line is, unfortunately my figures were real, are reproduceable on my system and reported to the devs. So for people like Nathan – please don’t get too defensive and aggressive next time – just in case you are wrong. And please do not start claiming that even smaps and private dirty memory consumption is not “real”.
113 Responses to "Let the user decide if in doubt"
I agree, i am spending time in #kde channel trying to answer questions, a frequent question is how to completely remove akonadi
In the case of lancelot, the application could be stopped when the menu closes, and restarted when it opens again. This would also solve the weird bugs where it malfunctions if you leave while in the applications sub lists.
However, the problem is that the application is noticeably slow to start
Why would anyone want to run KMail without Akonadi?
At least in the “next” version everything is stored in Akonadi.
I dont’t think the user should be bother to know how to autostart something.
And what is the problem on a normal computer (at least 2 cores, gigs of memory) with running Akonadi?
Because IMO it is getting to the point that a 2 core box is not enough.
Upgrade your Akonadi, your Strigi AND your KMail (last 2 ones from GIT). I’ve reduced all resource usage to acceptable levels with my TurionX2 3-year-old 2 core machine.
Concerning lancelot I think it’s a rarely-encountered issue since people dont add/remove a plasmoid as part of their daily routine. I wonder what those “other users” are though, and if they could be reference-counted so that the app can close when no longer needed.
Concerning akonadi, if it is indeed optional at runtime (I thought it had become mandatory ?), I think the proper choice when starting kmail is “1) never use it 2) use it if already started 3) start it if necessary and always use it”. And yes, all optionaly-akonadi-using apps should probably have those options.
But shutting down akonadi automaticaly (or not) is something that should be configured in an akonadi-specific GUI, not in the kmail GUI. Because it affects more than kmail. Yes, we need a GUI to start/stop akonadi.
http://www.joelonsoftware.com/uibook/chapters/fog0000000059.html
I _strongly_ disagree. Starting/stopping akonadi is a highly “computer-thingy-internal” stuff. Users absolutely do not care about it.
And why should they? They only want to read the mail, edit events etc. No matter what.
Asking the user simply means mixing the user’s model with the program’s model.
The result is a bad UX – sorry.
My choice would be to only notify the user that aconadi is now started (with the kontact startup).
I totally and strongly disagree.
Asking the user whether to start or stop some service is absolutely the wrong thing to do and I’ll tell you why: 99.9% of users will have no idea whatsoever what Akonadi is, let alone what it does. Therefore they will be afraid to make the wrong choice when forced to answer a popup question that they don’t know or understand the consequences of. This causes them uncertainty and in the end, it will make them go back to Windows or whatever else they used before, where they did not have to answer “these difficult questions”.
Instead, an application needs to be smart and figure out a sane default as to when to start and stop important services.
I couldn’t agree more. If we want to make user-friendly system, we need to make the important decisions for them.
I agree with Joe that the user really don’t care about akonadi, he will care about the functionalities it provides, so is quite useless to ask him.
But you did a great job raising this issues and I think that you should report it as bugs that need to be fixed. A plataform that have pretension to be on mobile really should care about wasting resources as you pointed.
Maybe a resonable solution is stop all services that are not being used (everybody that use a service should register on it) and start them only when needed, using something like Dbus.
I think your analysis is wrong.
A well written service (even a big one like Akonadi) should not be using any CPU and not causing any wake ups unless actually doing something useful. Also, it should not be using any RAM, but rather after some time of inactivity be swapped out.
Also, stopping and starting services does consume resources, so that should be avoided.
I would argue that asking the user whether or not to start Akonadi (does it really do this?) is a very bad idea. KMail could just start Akonadi when it is first needed.
Never ask the user unless you absolutely must. The user doesn’t know, and the user doesn’t care.
What you should be going after instead is applications/services waking up and doing work when they should be peacefully sleeping in swap.
Couldn’t disagree more. For a start, could you define ‘wasting’ CPU and RAM? If some code is leaking memory or has an inefficient loop that does some op that could be done out of loop then you could argue the code is ‘wasting’ these resources… (and your patch to plug the leak and move the op out of loop would be welcomed).
If however a process is doing a job and doing it efficiently then nothing is ‘wasted’. You might have a different view of the cost/benefit proposition of using resources to run the process but that is a different argument, and one that is nuanced by things like what the intended target platform is (modern desktop, legacy desktop, HTPC, tablet, phone, etc etc)
If you can’t get a configuration from a distribution that matches your device profile then that is one issue. If you are using a distribution targeted at one profile on a different (less capable?) one, that is another issue. If you are using an appropriately targeted distribution on it’s intended class of hardware then nagging the user over cryptic things like starting akonadai is just creating a dreadful user experience
I am 100% with Joe on this one.
An idle database uses no processing power. All your arguments about wasted CPU are completely invalid. As for the RAM, I would like to see some kind of evidence that backs your claim up.
There is no option to disable akonadi because KDE PIM *depends* on it. With nepomuk dolphin (and everything else) can just about work without it. It’d be like having a button to say “make my computer work”, “make my computer not work”. Stupid.
Users don’t enjoy to be the sysadmin of their computers, they should instead ejoy the great KDE user experience.
I disagree as well. one further reason is that imho by now computers are way more powerful than what most “home users” actually need, so wasting a bit of ram and cpu isn’t really a problem.
I agree with Joe and also disagree with this post.
Akonadi provides core functionality for KMail. KMail should always start it if it’s not already running without ever bugging me about it.
Yes, it would be a useful feature for Akonadi to be able to know if there are applications using it and shut itsself down accordingly. It would also be useful to have a checkbox in System Settings like for Nepomuk. But adding extra questions that 99% of users will not understand (Ok, I know what Akonadi is, but how do I know if I have other applications using it??) is the wrong solution.
I also have to disagree. Users should not need to worry about that sort of thing. Perhaps having a way to override it makes sense, but certainly not having a popup message by default.
And definitely not when starting a program like kmail, which won’t not work without akonadi. It is like asking “You just started your email application. Do you actually want to use the application, or just stare at the pretty interface?”
There is a reason the helper in Microsoft office was considered such a mistake. Users don’t want to bothered with random questions while they are trying to do something.
If there is a problem with applications not knowing when they should start or strop, then those applications should be fixed, the users shouldn’t need to handle it.
Did you ever read http://joelonsoftware.com/uibook/chapters/fog0000000059.html ?
Why not simply give an “option switch” to turn notification on or off.
But being notified of all processes is not the way I would like my system to be setup.
To be honest that sounds not like a good idea to me.
If I start kmail, I don’t care about the services it needs to get my work done. I don’t want to get asked if I want to start any service. I expect KMail to know on its own what it needs. But you’re right, if a service is no longer needed, it should suspend until needed again.
Lancelot is somehow the same. After I added it somewhere I expect it to be ready for use any time. I don’t want to click the menu icon and have to wait until a certain app has started. Lancelot should have aready been loaded. But again, you’re right, concerning removal. If I remove Lancelot, I want it to get disabled as well.
But if you really want, you can implement an akonadi module for systemsettings to start/stop the service, like for nepomuk. I would use it quite seldom, but maybe it would make sense to have it. Just in case.
“a) to have akonadi in memory just in case there is some other app using it or b) let the user take a decision which takes two seconds”
Neither.
Because the *is* a “right thing to do” here.
It would be:
c) Make Akonadi keep track of which applications start/stop using it – and if the last application stopped using it, quit.
And never bother the user about it, neither when starting nor when quitting.
(Of course a global system settings option should be available, maybe even set to true by default, for always keeping Akonadi pre-loaded (which would naturally override automatic quitting).)
I fully agree with the previous commenter:
Bothering the user with this kind of stuff is just plain wrong, especially if you want your software to (also) target average computer users (which, unless I’m mistaken, is the case with KDE).
But thats not the right thing to do. I don’t want a service to stop that will then just have to start up again next time an app comes along that needs it and instead of my app starting quickly and connecting to the already running service I then get to wait for the service to start also (something that may take an order of magnitude longer than simple app that just needs to access my contacts list)
What should (and does) happen is that the unused service should go to sleep and, as memory needs demand it, get mapped off to virtual memory, freeing up RAM until it needs to be mapped back into main storage.
So DBus has a nice functionality called auto-activation. When a program asks something of a D-Bus service, D-Bus is capable of starting it automatically and let it reply. Most well-behaved services that are potentially not needed all the time do not start if nothing needs it, and after a while of not being used, exit. As long as Akonadi behaves that way, it should indeed not matter for the user at all, asking the user if an implementation detail should be activated is nuts.
Let me give you an example: my IM client, Empathy, uses a D-Bus service called telepathy-gabble to provide XMPP connectivity so that I can chat with my jabber friends; it is automatically started by D-Bus when services are asked of it. Other clients (like GNOME Shell) can also hook into telepathy-gabble and do stuff with it. When there are no applications using it for a few seconds telepathy-gabble exists. Sounds sane, right?
If Akonadi is chewing a huge amount of resources when it’s used by tiny applications once in a while, then it’s shit and needs to be replaced (the same probably goes for, say, tracker, nepomuk), no point in putting the burden on the user because the technology sucks.
“If an application is not smart enough”
then
a.) the developers are not smart enough
b.) the developers are lazy
c.) the developers didn’t have the time to provide a real solution
Most of the time it’s issue c. And it’s mostly because the UX is not the primary focus. Which is ridiculous for a DE project!
Apple is so succesful because the UX is their primary focus. And they take the efforts to provide a smart solution. Even if they need to cut features.
Asking the user for every little thing is a very bad idea. It’s one of the (few) things gnome seems to do right…
I’ve seen my girlfriend figure out kde, and the only thing she seems to have problems with is the random pop-ups of which she doesn’t understand what they’re for. Please don’t add any more of those…
If a service is no longer needed it should be stopped automatically (if there is a use case for it there could be a configuration option to change the default behavior). Moving the responsibility of applications to the user seems to be a very bad idea…
what about a config option somewhere,
that if you wish for Akonadi to remain in memory incase you use kmail or the likes often, then it will.
or if you are not a heavy user that it will release itself after the parent/current applications using it have terminated.
this way no annoying notifications, most users will be happy with defaults as shown above, but for the users that care about their memory usage then they have the option to change this.
could this be a viable compromise?
i don’t see why this would be so hard to implement.
One easy improvement would be to autostart Akonadi systemtray integration with the workspace session.
This would allow easy manual starting/stopping.
Since Akonadi is already started on-demand, adding shutdown on-lack-of-demand quite a good idea IMHO.
Most information for that is probably already available in Akonadiserver (established data connections). The only thing missing is a way for only D-Bus using clients to register their need with Akonadiserver or Akonadicontrol.
Probably a bit too late for the Akonadi release which targets KDE’s 4.7 release, but that should make it easier for anyone who wants to try to get it done properly.
Any takers?
As far as I understand, akonadi should work like this:
1- You turn on the pc, akonadi might or might not be started as a process, but regardless it should not eat more than the 1 or 2 mb that’s needed for the process.
2- You open kmail, all the data from it is loaded on real ram, occupying real space (depends on mail quantity, a few hundred mb possibly).
3- You close kmail, ram is freed but still kept in the buffer, free for any other app to use, only using those 1 or 2 mb for the process.
So akonadi does not need to “stop” it only needs to free unused ram, but keep it in buffer, so if you have 4 gb of ram, it’s kept there mostly for ever, only showing in “mem” file of free command, but not under “-/+ Buffers…” (I mean that even if it uses 600mb they are not summed up in “free”, as they are only in the buffer). And if you have little memory, this is rapidly used after being freed, so that kmail data is not even in the buffer anymore.
About the little akonadi using plasmoids, if a plasmoids needs the ,maybe, 10/20mb of “this month events” data only that should be put into real ram, if the plasmoids tries to fetch all months data or something like that, the plasmoid is wrong designed and should be fixed to only fetch relevant data.
In conclussion, if akonadi works well enough (freeing ram when it’s not needed, and not using even 0.001% of cpu unless there is some query), then everything should be fine.
After all, akonadi is just a very small layer between an standard database(also some other stuff) and the apps, so it should not bother anyone.
PD: Also make it possible to permanently turn it off for minimal users, who don’t like that 1/2 mb used, or wan’t to disable akonadi features in things like plasmoids, etc.
PD2: AFAIK akonadi uses nepomuk for search, so akonadi ram usage might be misleading, as it might be putting stuff into nepomuk.
Seems to be part of a general trend towards assuming all KDE end-users are idiots in the KDE developer community. I remember back in KDE3 days when one of the great things about KDE was that the user could configure everything. And I mean EVERYTHING.
Whilst I agree with offering sensible default settings for everything, not pestering users too much, and maybe hiding the more esoteric settings for an application in some ‘advanced’ tab of a settings dialogue somewhere, I resent the fact that the degree of control I have over what my KDE system does is being gradually reduced. If I want to do something stupid with my desktop, I should be able to, even if I do then have to fix it later.
In the scenario above, it is entirely possible that a user is running KDE but not using any apps that use akonadi (e.g. if they do all their PIM using mozilla tools or web-based tools). It may be that a user is on a laptop with limited battery life. It may be that the user has an old system that doesn’t really have the necessary resources to keep akonadi going as a background thing (admittedly maybe they shouldn’t be trying to run KDE4 in this case). Thus the user should have some degree of control over when/if akonadi is run, though it is reasonable for those who don’t fit the ‘default’ user case to have to hunt a little to find the necessary settings.
1 | Will Thompson
May 5, 2011 at 18:48
Excellent idea. I think we could generalize this: we could extend dbus-daemon to support prompting the user before service-activating any service that isn’t running? So the application could just call methods on a service, and if it’s not running, rather than being silently launched, a dialog would be shown asking the user whether to go ahead and start it, or to return an error to the application.
We could extend the D-Bus .service file format to include user-readable descriptions of daemons—or maybe it could be pulled out of the Apt package descriptions.
rabauke
May 5, 2011 at 22:43
It’s understandable to forget about the first paragraphs if one reads a long text but it hinders understanding nonetheless.