]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal: use IteratedCache in sd-journal
authorVito Caputo <vcaputo@pengaru.com>
Sun, 8 Oct 2017 23:52:56 +0000 (16:52 -0700)
committerVito Caputo <vcaputo@pengaru.com>
Sat, 27 Jan 2018 21:11:58 +0000 (13:11 -0800)
commit5d4ba7f2b316a63ea5d98d749c5cb2cddf090854
tree96004385e490bc791e4d278e82709f55830f0a6e
parent45ea84d8edf57261a8e179f8058db6ba707dcde7
journal: use IteratedCache in sd-journal

This changes real_journal_next() to leverage the IteratedCache for
accelerating iteration across the open journal files.

journalctl timing comparisons with 100 journal files of 8MiB size
party to this boot:

Pre (~v235):
  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.613s
  user    0m9.560s
  sys     0m0.053s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.548s
  user    0m9.525s
  sys     0m0.023s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.612s
  user    0m9.582s
  sys     0m0.030s

Post-IteratedCache:

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.449s
  user    0m8.425s
  sys     0m0.024s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.409s
  user    0m8.382s
  sys     0m0.027s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.410s
  user    0m8.350s
  sys     0m0.061s

~12.5% improvement, the benefit increases the more log files there are.
src/journal/journal-internal.h
src/journal/sd-journal.c