From 4e915f9568806456ee5dbd69e43ef30ee465b47e Mon Sep 17 00:00:00 2001 From: Alina Djamankulova Date: Fri, 19 Nov 2021 16:25:47 -0800 Subject: PackBitmapIndexV1: support parallel loading of reverse index Speed up bitmap creation by loading reverse index in parallel to reading bitmap from storage. Latency changes from (time_to_read_bitmap + time_to_load_reverse_index) to max(time_to_read_bitmap, time_to_load_reverse_index). Add new option to DfsReaderOptions to control parallel reverse index loading. Static cached thread pool is added to PackBitmapIndexV1 for reverse index loading, and when not in use consumes minimal resources. Signed-off-by: Alina Djamankulova Change-Id: Ia37a1d739631d053e8bddb925ac8b0b81d22379e --- .../internal/storage/dfs/DfsBlockCacheTest.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'org.eclipse.jgit.test/tst/org/eclipse') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java index 4f1314057f..070d666ee5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java @@ -290,6 +290,31 @@ public class DfsBlockCacheTest { assertEquals(1, cache.getMissCount()[0]); } + @SuppressWarnings("resource") + @Test + public void highConcurrencyParallelReads_oneRepoParallelReverseIndex() + throws Exception { + InMemoryRepository r1 = createRepoWithBitmap("test"); + resetCache(); + + DfsReader reader = (DfsReader) r1.newObjectReader(); + reader.getOptions().setLoadRevIndexInParallel(true); + for (DfsPackFile pack : r1.getObjectDatabase().getPacks()) { + // Only load non-garbage pack with bitmap. + if (pack.isGarbage()) { + continue; + } + asyncRun(() -> pack.getBitmapIndex(reader)); + asyncRun(() -> pack.getPackIndex(reader)); + asyncRun(() -> pack.getBitmapIndex(reader)); + } + waitForExecutorPoolTermination(); + + assertEquals(1, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]); + assertEquals(1, cache.getMissCount()[PackExt.INDEX.ordinal()]); + assertEquals(1, cache.getMissCount()[0]); + } + private void resetCache() { resetCache(32); } -- cgit v1.2.3