A digital media streaming platform relies on a stateless recommendations microservice hosted on Google Cloud Run, backed by a Cloud SQL for PostgreSQL database. The engineering team needs to roll out a major feature release that includes a breaking database schema change (renaming several existing database columns). The deployment must achieve zero downtime and allow for an immediate rollback if errors occur during release cutover. How should the cloud architect design the deployment and database migration pipeline?
- AMigrate the stateless recommendations microservice from Cloud Run to a new Google Kubernetes Engine (GKE) Enterprise cluster with an Istio service mesh, and use GKE Ingress canary traffic management to resolve the database schema incompatibility during traffic shifting.
- Apply an expand-contract database migration strategy by first introducing backward-compatible schema changes, deploy the new Cloud Run revision alongside the existing revision, gradually split traffic to the new revision, and execute the contract phase to clean up obsolete columns only after the release is fully verified.Cevap
- CApply the non-backward-compatible database migration directly to the production Cloud SQL database first, deploy the new Cloud Run revision, and immediately update Cloud Run traffic routing to direct 100% of requests to the new revision.
- DProvision a duplicate Compute Engine Managed Instance Group (MIG) across multiple secondary regions without requesting regional compute quota increases in advance, run the database migration, and switch global Cloud Load Balancing IP targeting to the new MIG.
Cevap
Execute an expand-contract database migration strategy to maintain backward compatibility, allowing old and new Cloud Run revisions to serve traffic concurrently during traffic splitting before finalizing the schema cleanup.
The correct strategy uses the expand-contract (parallel change) database design pattern alongside Cloud Run revision traffic management. By ensuring the database schema remains backward-compatible during the transition, both the existing revision and the newly deployed revision can operate concurrently without errors. Once traffic is fully shifted and confirmed healthy, the old schema components can be safely retired.
Adım Adım Çözüm
Anahtar Kavram
Decoupled Blue-Green/Canary Deployments with Expand-Contract Database Schema Migration
Tahmini Süre:2m 0s