Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

perf(search): report the FTS reader cache in node stats

xerj-org09b4768ac666
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index a20e9224a..da61ccb0c 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -19788,6 +19788,7 @@ pub async fn nodes_stats(State(state): State<AppState>) -> impl IntoResponse {
"id_positions": { "current_in_bytes": gauge.category_current[4], "peak_in_bytes": gauge.category_peak[4], "map_capacity": capacities[4] },
"row_sequences": { "current_in_bytes": gauge.category_current[5], "peak_in_bytes": gauge.category_peak[5], "map_capacity": capacities[5] },
"decoded_stored": { "current_in_bytes": gauge.category_current[6], "peak_in_bytes": gauge.category_peak[6], "map_capacity": capacities[6] },
+ "fts_reader": { "current_in_bytes": gauge.category_current[7], "peak_in_bytes": gauge.category_peak[7], "map_capacity": capacities[7] },
}
})
});
diff --git a/engine/crates/xerj-engine/src/engine.rs b/engine/crates/xerj-engine/src/engine.rs
index 36750ea6e..fd51d2346 100644
--- a/engine/crates/xerj-engine/src/engine.rs
+++ b/engine/crates/xerj-engine/src/engine.rs
@@ -377,8 +377,10 @@ pub struct Engine {
}
impl Engine {
- pub fn segment_hydration_cache_capacities(&self) -> [usize; 7] {
- let mut total = [0_usize; 7];
+ pub fn segment_hydration_cache_capacities(
+ &self,
+ ) -> [usize; crate::segment_cache_budget::CATEGORY_COUNT] {
+ let mut total = [0_usize; crate::segment_cache_budget::CATEGORY_COUNT];
for index in self.indices.iter() {
let capacities = index.value().segment_hydration_cache_capacities();
for (sum, capacity) in total.iter_mut().zip(capacities) {
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rs
index 7db6cca12..5534d4533 100644
--- a/engine/crates/xerj-engine/src/index.rs
+++ b/engine/crates/xerj-engine/src/index.rs
@@ -37,7 +37,9 @@ use xerj_vector::hnsw::{HnswIndex, HnswParams};
use xerj_vector::Sq8Params;
use crate::aggs::run_aggs_with_all;
-use crate::segment_cache_budget::{CacheResident, SegmentCacheCategory, SegmentHydrationBudget};
+use crate::segment_cache_budget::{
+ CacheResident, SegmentCacheCategory, SegmentHydrationBudget, CATEGORY_COUNT,
+};
use crate::segment_cache_estimates as cache_estimates;
pub(crate) type Resident<T> = Arc<CacheResident<T>>;
@@ -5156,7 +5158,7 @@ impl Index {
/// Aggregate DashMap table capacities for the seven hydration families.
/// These are diagnostic table slots, separate from the refundable
/// retained-payload/key budget.
- pub fn segment_hydration_cache_capacities(&self) -> [usize; 7] {
+ pub fn segment_hydration_cache_capacities(&self) -> [usize; CATEGORY_COUNT] {
[
self.stored_slices_cache.capacity(),
self.dv_cache.capacity(),
@@ -5165,6 +5167,7 @@ impl Index {
self.id_pos_cache.capacity(),
self.row_seq_cache.capacity(),
self.decoded_stored_cache.capacity(),
+ self.fts_reader_cache.capacity(),
]
}