Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions control/src/admin/local_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl GatewayQuery for LocalGatewayQuery {
open_circuits,
exhausted_rate_limiters,
listeners: vec![],
cache_stats: Some(self.cache_stats_internal()),
cache_stats: None, // LRU cache removed — ArcSwap is faster
})
}

Expand Down Expand Up @@ -117,7 +117,9 @@ impl GatewayQuery for LocalGatewayQuery {
}

async fn cache_stats(&self) -> anyhow::Result<Option<CacheStats>> {
Ok(Some(self.cache_stats_internal()))
// LRU cache was removed — ArcSwap route snapshot is faster.
// Return None to signal caching is not applicable.
Ok(None)
}

async fn metrics_snapshot(
Expand Down Expand Up @@ -163,23 +165,3 @@ impl GatewayQuery for LocalGatewayQuery {
anyhow::bail!("undrain_backend not yet implemented via admin API")
}
}

impl LocalGatewayQuery {
fn cache_stats_internal(&self) -> CacheStats {
let (hits, misses) = self.router.get_cache_stats();
let size = self.router.get_cache_size();
let total = hits + misses;
let hit_rate = if total > 0 {
hits as f64 / total as f64
} else {
0.0
};

CacheStats {
hits,
misses,
size,
hit_rate,
}
}
}
Loading
Loading