Google Cloud Blog
Follow
How to upgrade embedding models in AlloyDB AI with zero downtime
Upgrading embedding models in production without downtime presents significant challenges. Re-embedding entire datasets, rebuilding indexes, and managing schema changes can disrupt user queries and degrade the user experience. Mathematical incompatibility between models further complicates direct comparison of embeddings. AlloyDB AI offers a solution to these problems by simplifying vector lifecycle management. Its model endpoint management allows in-database access to various embedding models, while auto embeddings efficiently generate and update new embeddings in the background. AlloyDB's ScaNN index offers significantly faster build times compared to open-source alternatives. Native PostgreSQL features like concurrent index creation and atomic column renames enable zero-downtime blue/green and canary rollouts. The process begins by checking prerequisites and adding a nullable column for the new embeddings. Auto-embeddings are then initialized to backfill existing data and keep embeddings updated. Manual mode for auto-embeddings allows for scheduled refreshes to catch up changed rows. Before cutting over traffic, it's crucial to validate vector completeness and retrieval quality. Building a ScaNN vector index, optimized for high dimensions, is essential for efficient search performance. Finally, traffic cutover can be achieved using an atomic column rename swap or a more advanced approach with GUC session variables and a unified UNION ALL set-returning function for flexible release strategies.