[systemd-devel] How to use cgroups for Tracker?

Martyn Russell martyn at lanedo.com
Thu Oct 16 06:07:44 PDT 2014


On 15/10/14 16:01, David Timothy Strauss wrote:
> I'm responding here only to the systemd list.

Thanks David, I appreciate your comments.

> On Tue, Oct 14, 2014 at 4:35 PM, Martyn Russell <martyn at lanedo.com> wrote:
>> Does anyone have any suggestions or projects that lead by example that
>> Tracker could/should follow?
>
> Your case with the out-of-control plugins is hard, but I think a
> simple hard limit on memory is the wrong answer (as the bug
> demonstrates). With cgroups, you can register handlers for memory
> pressure to elegantly handle shutting down or unloading plugins. You
> can also query the memory usage "charged" to a cgroup to determine
> when things are getting out of control. While cgroups can also set
> memory limits where the processes will swap when allocation exceeds a
> specified limit, you may find that creates an even more undesirable
> load on I/O.

That's true. I would likely have a hard limit on I/O too. I'm not 
entirely sure what happens then - I guess the plugin just struggles with 
what resources it has.

> It is easier to throttle CPU or I/O as prevention against running
> wild. For those, I recommend reading what systemd offers for
> cgroups-cased resource management [1]. Those controls may be overkill,
> though, if you don't care about starvation, so please consider my
> answer to your next question, too.

Thanks for the link.

>> Orthogonal to all of this, is another idea I had, which is to completely
>> pause Tracker when the user is present (keyboard/mouse use) to avoid wasting
>> cycles on stuff the user doesn't care about - a bit like how chat clients
>> know when you're away or not. Maybe we should do both?
>
> The user being active doesn't mean substantial load is on the system.

True, but some users (I am guessing with low end machines) are 
complaining about Tracker while they're trying to use their system.

> Plus, users might get annoyed that changes they're making aren't
> getting indexed. If you're okay with the Tracker getting starved --

That's the trade off, I think giving the choice is what's important - 
it's clear that some users want that choice and applications have the 
ability right now (and do) tell Tracker what content to index when a 
user is interacting with that content. So it's a two pronged approach.

> and you seem to be given the thought of stopping it when a user is
> active -- I would have the Tracker run with IOSchedulingClass=idle and

We currently use "idle" then "best effort" (on failures) where supported 
by the architecture already (so values 3 and 2 respectively). But it's 
not enough it seems.

> Nice=19 [2], which aren't options exclusive to systemd in any way.

We do this too :/

I personally don't notice Tracker, but some people do - I do wonder if 
you can ever eliminate users complaining about a content indexing 
service. It's a fine line.

> [1] http://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
> [2] http://www.freedesktop.org/software/systemd/man/systemd.exec.html

Thanks for the links, most useful!

-- 
Regards,
Martyn


More information about the systemd-devel mailing list