Skip to content

CNDB-13583: Add vector ann and brute force metrics #1683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025
Merged

Conversation

michaeljmarshall
Copy link
Member

@michaeljmarshall michaeljmarshall commented Apr 8, 2025

What is the issue

https://github.com/riptano/cndb/issues/13583

What does this PR fix and why was it fixed

This PR adds comprehensive metrics for Storage Attached Indexes (SAI) vector search operations, providing crucial insights into both ANN (Approximate Nearest Neighbor) graph searches and brute force operations.

New Vector Search Metrics:

Search Operation Counters:

  • ANNNodesVisited: Total number of nodes visited during ANN searches (this is equivalent to approximate similarity score computations)
  • ANNNodesReranked: Number of nodes that underwent exact distance computation for reranking (this is equivalent to exact similarity score computations)
  • ANNNodesExpanded: Total number of nodes whose edges were explored
  • ANNNodesExpandedBaseLayer: Number of nodes expanded in the base layer of the graph
  • ANNGraphSearches: Count of new graph searches initiated
  • ANNGraphResumes: Count of resumed graph searches (when a search continues from previous results)
  • ANNGraphSearchLatency: Timer measuring individual graph search latency (Note: This measures per-graph search time, not total query time which may involve multiple graphs)

Brute Force Operation Counters:

  • BruteForceNodesVisited: Number of nodes visited during brute force searches (approximate similarity comparisons)
  • BruteForceNodesReranked: Number of nodes that underwent exact similarity computation during brute force searches

Memory Usage Tracking:

  • quantizationMemoryBytes: Current memory usage by the quantization (PQ or BQ) data structures
  • ordinalsMapMemoryBytes: Current memory usage by ordinals mapping structures (only matters in some cases)
  • onDiskGraphsCount: Number of currently loaded graph segments
  • onDiskGraphVectorsCount: Total number of vectors in currently loaded graphs

These metrics will help us:

  1. Understand if we are performing more comparisons than expected
  2. Get insight into number of graphs queried
  3. Get insight into the brute force vs graph query path
  4. Understand current memory utilization

The counters provide operations/second metrics, allowing calculation of per-query averages by dividing by the number of queries. The memory tracking metrics help monitor resource usage across graph segments as they are loaded and unloaded.

Copy link

github-actions bot commented Apr 8, 2025

Checklist before you submit for review

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@michaeljmarshall michaeljmarshall changed the title CNDB-13583: save initial work in progress CNDB-13583: Add vector ann and brute force metrics Apr 9, 2025
@michaeljmarshall michaeljmarshall marked this pull request as ready for review April 9, 2025 22:15
@michaeljmarshall michaeljmarshall self-assigned this Apr 9, 2025
Copy link

sonarqubecloud bot commented Apr 9, 2025

@cassci-bot
Copy link

✔️ Build ds-cassandra-pr-gate/PR-1683 approved by Butler


Approved by Butler
See build details here

Copy link

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@eolivelli eolivelli merged commit c02e486 into main Apr 10, 2025
469 of 475 checks passed
@eolivelli eolivelli deleted the cndb-13583 branch April 10, 2025 15:25
djatnieks pushed a commit that referenced this pull request Apr 14, 2025
### What is the issue
riptano/cndb#13583

### What does this PR fix and why was it fixed
This PR adds comprehensive metrics for Storage Attached Indexes (SAI)
vector search operations, providing crucial insights into both ANN
(Approximate Nearest Neighbor) graph searches and brute force
operations.

New Vector Search Metrics:

Search Operation Counters:
- `ANNNodesVisited`: Total number of nodes visited during ANN searches
(this is equivalent to approximate similarity score computations)
- `ANNNodesReranked`: Number of nodes that underwent exact distance
computation for reranking (this is equivalent to exact similarity score
computations)
- `ANNNodesExpanded`: Total number of nodes whose edges were explored
- `ANNNodesExpandedBaseLayer`: Number of nodes expanded in the base
layer of the graph
- `ANNGraphSearches`: Count of new graph searches initiated
- `ANNGraphResumes`: Count of resumed graph searches (when a search
continues from previous results)
- `ANNGraphSearchLatency`: Timer measuring individual graph search
latency (Note: This measures per-graph search time, not total query time
which may involve multiple graphs)

Brute Force Operation Counters:
- `BruteForceNodesVisited`: Number of nodes visited during brute force
searches (approximate similarity comparisons)
- `BruteForceNodesReranked`: Number of nodes that underwent exact
similarity computation during brute force searches

Memory Usage Tracking:
- `quantizationMemoryBytes`: Current memory usage by the quantization
(PQ or BQ) data structures
- `ordinalsMapMemoryBytes`: Current memory usage by ordinals mapping
structures (only matters in some cases)
- `onDiskGraphsCount`: Number of currently loaded graph segments
- `onDiskGraphVectorsCount`: Total number of vectors in currently loaded
graphs

These metrics will help us:
1. Understand if we are performing more comparisons than expected
2. Get insight into number of graphs queried
3. Get insight into the brute force vs graph query path 
4. Understand current memory utilization

The counters provide operations/second metrics, allowing calculation of
per-query averages by dividing by the number of queries. The memory
tracking metrics help monitor resource usage across graph segments as
they are loaded and unloaded.
djatnieks pushed a commit that referenced this pull request May 18, 2025
### What is the issue
riptano/cndb#13583

### What does this PR fix and why was it fixed
This PR adds comprehensive metrics for Storage Attached Indexes (SAI)
vector search operations, providing crucial insights into both ANN
(Approximate Nearest Neighbor) graph searches and brute force
operations.

New Vector Search Metrics:

Search Operation Counters:
- `ANNNodesVisited`: Total number of nodes visited during ANN searches
(this is equivalent to approximate similarity score computations)
- `ANNNodesReranked`: Number of nodes that underwent exact distance
computation for reranking (this is equivalent to exact similarity score
computations)
- `ANNNodesExpanded`: Total number of nodes whose edges were explored
- `ANNNodesExpandedBaseLayer`: Number of nodes expanded in the base
layer of the graph
- `ANNGraphSearches`: Count of new graph searches initiated
- `ANNGraphResumes`: Count of resumed graph searches (when a search
continues from previous results)
- `ANNGraphSearchLatency`: Timer measuring individual graph search
latency (Note: This measures per-graph search time, not total query time
which may involve multiple graphs)

Brute Force Operation Counters:
- `BruteForceNodesVisited`: Number of nodes visited during brute force
searches (approximate similarity comparisons)
- `BruteForceNodesReranked`: Number of nodes that underwent exact
similarity computation during brute force searches

Memory Usage Tracking:
- `quantizationMemoryBytes`: Current memory usage by the quantization
(PQ or BQ) data structures
- `ordinalsMapMemoryBytes`: Current memory usage by ordinals mapping
structures (only matters in some cases)
- `onDiskGraphsCount`: Number of currently loaded graph segments
- `onDiskGraphVectorsCount`: Total number of vectors in currently loaded
graphs

These metrics will help us:
1. Understand if we are performing more comparisons than expected
2. Get insight into number of graphs queried
3. Get insight into the brute force vs graph query path 
4. Understand current memory utilization

The counters provide operations/second metrics, allowing calculation of
per-query averages by dividing by the number of queries. The memory
tracking metrics help monitor resource usage across graph segments as
they are loaded and unloaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants