arunkumarucet opened a new pull request, #20439: URL: https://github.com/apache/pinot/pull/20439
On a consuming segment, every unfiltered vector search opened a new `DirectoryReader` over the committed index and closed it after the search (`MutableVectorIndex#executeVectorSearch`). Each query re-read the commit point, memory-mapped and header-checked every index file, searched cold mappings, then unmapped them all. The filtered path already reuses a `SearcherManager` (#19467); the unfiltered path has opened per query since the original HNSW implementation (#11977). **Change** Keep a second `SearcherManager` over the committed index. The indexing thread refreshes it right after each commit, and the unfiltered path acquires and releases a searcher from it. - Visibility is unchanged: unfiltered queries still see exactly the last commit (`commitIntervalMs` / `commitDocs`). - A failed refresh is logged and leaves queries on the previous commit. It does not fail ingestion, and the next commit retries. - The new manager is closed with the other resources on every close and constructor-failure path. **Profile before the change** Cohere 100K x 768, one consuming segment, 10 concurrent clients, single-node quickstart: - The server used ~6 cores, about 25 CPU-ms per query. - About half of all CPU time was in the kernel. - The server took ~247M page faults. - Thread dumps showed query threads in `DirectoryReader.open` -> `mmap` / `CodecUtil.checkHeader` and `IndexReader.close` -> `munmap`. A standalone Lucene microbenchmark on the same 16-segment index: | Per query | Time | |---|---| | Open + search + close (before) | 8.1 ms | | Search on a reused reader | 1.4 ms | **Measured after the change** Same machine and data: | | Before | After | |---|---|---| | QPS, 10 concurrent clients | 241 | **966** | | p50 / p99 latency | 41.8 / 68.3 ms | **10.0 / 18.3 ms** | | Kernel share of CPU | ~49% | ~20% | | VectorDBBench `StreamingPerformanceCase` (500 rows/s), QPS at 100% inserted | 369 | **1,281** | | Same case, serial p99 | 11.7 ms | **6.2 ms** | Recall and ingestion rate are unchanged (0.954 recall@100, insert kept pace in both). **Testing** Added `MutableVectorIndexTest#testUnfilteredSearchSeesEachCommitButNotUncommittedDocs`. It checks that unfiltered search sees committed rows, does not see uncommitted ones, and sees new rows after the next commit. Removing the post-commit refresh fails it, along with four existing tests. All 29 tests in the class pass. Labels: `performance`, `bugfix` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
