[systemd-devel] Journald - heap size

Lennart Poettering lennart at poettering.net
Wed Aug 20 15:09:18 PDT 2014


On Wed, 20.08.14 16:48, Christian Häßelbarth (mail at christianhaesselbarth.de) wrote:

> I've set the storage option to "none" in my journal.conf, assuming that journald
> will drop all data. Is that correct?

Well, I am not sure what you mean by "drop". Versions of journald older
than 216 actually would forward all logs to a possibly running syslog
implementation. We don't do this with 216 anymore, but we still forward
messages to the console if they have a certain log level. But yeah, if
you set Storage=none, then journald won't save anything in /var/log or
/run/log.

> I'm using systemd in an embedded device context and I would like to
> save memory. I understand your point regarding allocation cache etc.
> 
> If I get you right then it is quite normal that journald allocates ~6 MB of
> memory.

Well, measuring memory like this isn't that easy really. For example the
allocation cache mostly reserves address space, and this is only backed
by real memory much later.

If you want reliable data on how much heap is really used and by what
precisely you'd have to use a tool like valgrind, or so.

> Is there any configuration option to avoid this high memory usage?  For exampel
> with the options storage=yes and SystemMaxUse=1MB ?

Well, first of all I don't really think that 6MB is that bad. But more
importantly, I'd really recommend to use some better tools to figure out
what precsiely consumes your memory, before you try to optimize it. The
raw data from /proc is not useful for that. 

Also, even in an embedded device you need some form of logging, and
running only journald with its storage engine turned on is probably a
better choice than using it together with a parallel syslog. Or are you
designing a device that never logs at all?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list