[systemd-devel] [EXT] Re: slowness reading persistent journal

Lennart Poettering lennart at poettering.net
Wed May 7 08:13:52 UTC 2025


On Mi, 07.05.25 06:48, Windl, Ulrich (u.windl at ukr.de) wrote:

> Hi!
>
> SLES Support is working on it, and that support claimed that
> journalctl would output the journal line-by-line, calling fstat for
> each journal file for each line to output. So for 100 journal files
> and 6 million lines of journal, that number would be simply
> crazy. Most of all I'd wonder what the original programmer did think
> about it: Modern systems are fast anyway, so any algorithm would do?
> Disclaimer: I did not inspect the actual code; it's just what
> support told me.

yeah, this is not what happens. It's very easy to see:

  # strace -o log -s 500 -y journalctl -n 100 --no-pagerstrace -o log -s 500 -y journalctl -n 100 --no-pager
  # grep fstat\( log

This looks for fstat() calls on the output of 100 log lines. As you
can see each journal file is fstat()ed once, not 100 times.

Hence, your support line is wrong.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list