gerrit/lib/truth
Dave Borowitz bab45861b7 Optionally persist ChangeNotesCache
Loading ChangeNotes into the ChangeNotesCache should generally be pretty
fast when the underlying git repository storage is fast, but there are
some situations where that is not the case:

* The repo hasn't been GC'ed in a while, so may contain a lot of loose
  objects.
* On googlesource.com using the JGit DFS backend, when GC has happened
  recently and the DFS block cache is cold.

These problems are particularly noticeable on a cold server start.

As an optional optimization, allow persisting the ChangeNotesCache. For
installations where cache loading latency hasn't proven to be a problem,
it may not be worth the disk space, but we think it will make a
difference for googlesource.com.

Writing the necessary protos was a bit of work, but actually the
marginal cost of tweaking fields should be relatively low, and any
change should cause a small test to fail, so we should be able to detect
any changes as they arise. I explicitly chose to reuse existing
serialization mechanisms where possible (ProtobufCodecs, JSON), to limit
the size of this change. This is just cache data, so it's not like it
has to be particularly pretty or long-lasting.

This change is not intended to indicate we are giving up on optimizing
loading ChangeNotes from storage, but is more of a bandaid for fixing
performance problems in production today.

Change-Id: I1ffe15fe56b6822b7f9af55635b063793e66d6fd
2018-05-18 11:17:49 -04:00
..
BUILD Optionally persist ChangeNotesCache 2018-05-18 11:17:49 -04:00