diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-12-09 20:27:19 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-12-09 21:43:34 +0100 |
commit | b7c88ab8cc7d55a43450bf3dea750f95f2e910d6 (patch) | |
tree | 253914fdcb32ab6bda4482ec832d01fa4b8c13ec /src/resolve | |
parent | 1372d5eff4631aeec132b8e22d243fb81a4fdbc8 (diff) |
journal: optimize iteration: skip whole files behind current location
Interleaving of entries from many journal files is expensive. But there
is room for optimization.
We can skip looking into journal files whose entries all lie before the
current iterating location. We can tell if that's the case from looking
at the journal file header. This saves a huge amount of work if one has
many of mostly not interleaved journal files.
On my workstation with 90 journal files in /var/log/journal/ID/
totalling 3.4 GB I get these results:
Before:
$ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null
real 5m54.258s
user 2m4.263s
sys 3m48.965s
After:
$ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null
real 0m20.518s
user 0m19.989s
sys 0m0.328s
The high "sys" time in the original was caused by putting more stress on
the mmap-cache than it could handle. With the patch the working set
now consists of fewer mmap windows and mmap-cache is not thrashing.
Diffstat (limited to 'src/resolve')
0 files changed, 0 insertions, 0 deletions