Lesson 2 of 3 Monitoring Agents, Tools and Vector Stores

Operating Vector Stores in Production

This lesson covers performance monitoring, automated index maintenance and data quality validation for vector stores, since a slow, full, stale or poor-quality store degrades every RAG answer.

Learning outcomes

After completing this lesson, you will be able to:

  • Monitor vector store performance.
  • Automate index optimisation.
  • Validate the data quality of stored chunks.

Performance monitoring

The vector store is on the path of every RAG request, so its health directly affects the application's latency and availability. Each store exposes its own metrics. For OpenSearch Service, the key metrics are search latency and rate, indexing latency and rate, CPU utilisation, JVM memory pressure, k-NN graph memory usage and circuit breaker trips, free storage space and cluster health status; high JVM memory pressure or circuit breaker trips warn that searches are about to fail. OpenSearch Serverless reports the OpenSearch Compute Units (OCUs) consumed by search and indexing.

For Aurora PostgreSQL with pgvector, the metrics to watch are query latency, CPU, memory and the buffer cache hit ratio, and CloudWatch Database Insights identifies slow vector queries. For Bedrock Knowledge Bases, ingestion job statistics report the documents scanned, indexed, modified, deleted and failed in each sync.

The following diagram shows a gradual decline in retrieval recall and the response to it.

Diagnosing a gradual recall decline. Over three months, test queries retrieving the correct document fell from 92% to 78% while latency stayed normal. Data quality scans found empty chunks from a new scanned-document source and duplicate versions of updated documents; an advanced parser, deleting superseded versions and scheduled recall and empty-chunk checks fix it.
The intermediate monthly values are illustrative.

Automated index optimisation

Vector indexes degrade over time as documents are updated and deleted: deleted vectors leave gaps, index segments multiply and search slows down. Automated optimisation routines, run on a schedule with EventBridge Scheduler and a Lambda function or Step Functions workflow, keep indexes efficient. They merge segments, rebuild indexes after large deletions, roll over time-based indexes, and re-index into new settings, building the new index alongside the old one and switching an alias to it once it is complete, so searches are never interrupted.

For pgvector in Aurora PostgreSQL, routine VACUUM and ANALYZE operations and periodic index rebuilds keep query plans efficient. Capacity alarms on memory and storage trigger scaling before the store runs out of resources and searches start to fail.

Match the pairs

Index maintenance tasks

Exam skills 4.3.5

Match each automated maintenance task with the problem it addresses.

Log in to try this activity Interactive activities are free with an account.

Data quality validation

Data quality validation checks the content of the store, not just its health: chunks with empty or near-empty text, duplicate chunks, missing required metadata, documents whose source no longer exists, and documents older than their freshness requirement. A fixed set of test queries with known relevant documents is run on a schedule to measure recall; a drop indicates ingestion, parsing or embedding problems. Failed ingestion documents are reviewed and fixed. The following table summarises the operational checks.

CheckSignalAction
Search latency and memoryOpenSearch or Aurora metricsTune index; scale; add replicas
Ingestion failuresIngestion job statisticsFix parsing or document issues; alert owners
Index fragmentationDeleted documents, segment countsScheduled merges or reindex with alias swap
Empty, duplicate or stale chunksScheduled data quality scansRemove, re-ingest or re-parse
Retrieval recallScheduled test queriesInvestigate chunking, parsing or embeddings
Select all that apply

Checking what is in the store

Exam skills 4.3.5

Choose the content checks that a scheduled vector store data quality job should run.

Log in to try this activity Interactive activities are free with an account.
Worked example

Gradual recall decline

Over three months, the share of test queries that retrieve the correct document drops from 92% to 78%. Latency is normal.

Data quality scans find thousands of empty chunks from a new scanned-document source and duplicate versions of updated documents. The team switches that data source to an advanced parser, deletes superseded versions through sync, and adds the recall test and an empty-chunk check to the scheduled validation with alarms.

Check yourself

How can an index be rebuilt without downtime?

Show answer

Reindex into a new index and swap an alias to point to it.

Exam Tips

Remember for the exam

  • Monitor latency, memory, storage and ingestion statistics for vector stores.
  • Schedule index maintenance; reindex with alias swaps.
  • Validate content: empty, duplicate, stale chunks and missing metadata.
  • Run fixed recall tests on a schedule.