Hi @jamsharp !
I double-checked multiple settings and the implementations; these are our points for improvement. There is exactly one thing worth changing on your side, and we measured the rest properly so we can prove the fixes land.
The one thing on your side - Call Optimize() once at the end of ingest, not every 300 MB.
That is it. Nothing else in your configuration is causing this.
What we measured
20 GB of mixed office documents, 29,031 files, one Optimize() at the end:
|
before Optimize() |
after |
| Index |
18.56 GB |
1.24 GB |
index*.head — term offsets |
16.71 GB |
116 MB |
index*.body — postings |
1.60 GB |
909 MB |
| Segments |
365 |
1 |
| Ratio to source |
92.8% |
6.2% |
We reproduced your 94% on a different corpus,
then watched it collapse to 6.2% — inside the 10–33%
you expected.
The ratio turns out to be a function of segment count and nothing else:
| Segments |
1 |
81 |
229 |
365 |
| Index / source |
13.6% |
52.7% |
83.3% |
99.3% |
Each segment’s .head holds a 4-byte slot for every term in the whole index, present in that
segment or not. At 30.5M terms that is 116 MB per segment — 365 of them, one real and 364 padding.
So the fixes are ours:
- Automatic segment merging — the real one. Keeps segment count logarithmic so this stops
existing. No reindex, no configuration, no advice needed.
- Sparse
.head tables — store only the terms a segment actually contains, removing the waste
at source instead of cleaning it up afterwards.
- Postings encoding, and a storage-diagnostics API so nobody has to paste a directory listing into
a forum again.
Two things not to bother with, since both look like levers and are not: **CompactIndex makes the
ratio worse** (postings shrink, .head does not, so overhead’s share rose to 84%), and alphabet or
stop-word tuning moves far less than the merge does.
How we will prove it
We built a profiler and published it on GitHub: Document Indexing Storage Lab.
It indexes a corpus under a size budget and reports where every byte went — the .head / .body / dictionary split, vocabulary size, ratios against both source bytes and extracted text, and memory including retained heap after a forced collection, before and after Optimize().
Every run is stored with the GroupDocs.Search version, runtime, GC mode and a hash of the exact file set, so the same corpus on a future release is provably comparable — that is the point. When auto-merge and sparse .head ship, we will re-run this identical 20 GB corpus and post the before/after rather than asking you to take our word for it. One number for the memory side: peak private was 26.15 GB on a 32 GB machine, and the single final Optimize() is the spike.
Auto-merge would do incrementally what one big merge currently does in a single very expensive step — which is why it fixes both threads at once.
Summary
There are multiple improvements we scheduled for the nest product releases. So give us some time to adjust and deliver them.
Thank you!
P.S. In the published tool you can see various sessions, and you can start new ones that will be saved. So this will be a good snapshot to compare with the other version.