Offloading Cloud SQL Read Traffic with Read Replicas
Short answer
D Enable automatic backups and create a read replica to offload read traffic from the primary Cloud SQL instance.
Question
Key Takeaways
Use Cloud SQL read replicas to offload read queries from the primary instance, improving performance with minimal code changes and cost. This approach avoids the complexity of caching layers or the expense of vertical scaling.
Expert Analysis
Cloud SQL read replicas offload read queries from the primary, improving read performance without modifying the application database.
The core challenge in this scenario is to decouple read-heavy workloads from a primary Cloud SQL instance to enhance performance while strictly adhering to constraints of minimal effort and cost. The correct approach leverages Cloud SQL's native replication capabilities, which provide a mechanism to distribute read traffic without requiring significant architectural changes or additional infrastructure management overhead compared to alternative caching strategies.
Option D is the correct choice because enabling automatic backups and creating a read replica directly addresses the read-performance bottleneck through asynchronous replication. A read replica maintains an identical copy of the data on a separate instance, allowing the application (or a load balancer) to direct read-only queries to the replica. This effectively offloads the primary instance, reducing latency for readers and freeing up IOPS on the master for write operations. Crucially, this solution aligns with the "minimize effort" constraint because it requires no code changes to the application logic; the application continues to interact with the same database endpoint structure, or uses simple connection routing that can be managed at the proxy level. It also satisfies the "minimize cost" requirement relative to other scaling options, as you only pay for the additional compute resources of the replica, avoiding the premium costs associated with larger instance types or complex caching layers.
Option A, using Cloud CDN, is incorrect because Cloud Content Delivery Network is designed for caching static assets such as images, CSS, JavaScript files, and HTML pages at edge locations. It does not support dynamic database query results or structured data stored in a relational database like Cloud SQL. Attempting to cache database responses via CDN would require custom logic to handle invalidation, consistency, and TTL management, which violates the "minimize effort" constraint and fails to solve the underlying database read pressure.
Option B, storing frequently accessed data in a Memorystore instance (Redis or Memcached), involves a different trade-off profile. While Memorystore offers low-latency access, implementing it requires significant development effort. The application code must be modified to detect cache hits and misses, manage cache synchronization with the source of truth (Cloud SQL), and handle cache invalidation strategies to prevent stale data. This introduction of application-level complexity directly contradicts the goal of minimizing effort. Additionally, Memorystore adds another managed service layer to monitor and secure, potentially increasing operational overhead.
Option C, migrating the Cloud SQL database to a larger instance type, is a vertical scaling strategy. While this increases the total capacity of the primary instance, it does not offload read traffic; the primary instance still handles all reads and writes. Furthermore, larger instances incur higher hourly costs, and there is a hard limit to how large a single instance can grow before horizontal scaling becomes necessary. This option fails both the "offload" and "minimize cost" criteria, as you are paying more for a single point of failure rather than distributing the load.
The decisive factor here is the distinction between offloading vs. augmenting. Read replicas physically move the read workload away from the primary. Caching (Memorystore) moves data closer to the app but requires code changes. Vertical scaling (larger instance) just makes the bottleneck bigger but doesn't remove it. For a web application needing immediate read performance improvement with minimal code intervention, Cloud SQL read replicas are the standard, lowest-friction pattern in Google Cloud architecture.
Exam Strategy
When asked to improve read performance with minimal code changes, look for replication features first. Read replicas (in Cloud SQL, Spanner, etc.) are the default answer for offloading reads because they require zero application refactoring. Reserve caching solutions like Memorystore for scenarios where sub-millisecond latency is critical and development effort is acceptable. Avoid vertical scaling options when 'offload' is the keyword, as scaling up does not distribute load.
Related Analysis
Practice All ADP Questions
Access 65 questions with complete answers and detailed explanations.
View Full ADP Practice Test →