Google Professional Cloud Database Engineer Question 166
Select 3Google Cloud PlatformYou are managing a Cloud Spanner database that supports a global e-commerce application. As the application scales, you notice increased latency during peak traffic hours. To address this, you need to decide between scaling up or scaling out the database. Which of the following actions would help optimize performance while adhering to Cloud Spanner's architecture?
- A
Increase the number of nodes in the Cloud Spanner instance to distribute the load across more resources.
- B
Upgrade the Cloud Spanner instance to a higher CPU and memory configuration.
- C
Shard the database manually by partitioning data across multiple Cloud Spanner instances.
- D
Adjust the schema by creating additional interleaved tables to optimize data locality and reduce latency.
- E
Use Cloud Spanner's autoscaler to dynamically add or remove nodes based on traffic patterns.
Show answer and explanation
Correct answers: A, D, E
Explanation
Scaling in Cloud Spanner involves scaling out (adding/removing nodes) rather than scaling up (upgrading hardware), as it is a horizontally scalable database. Increasing nodes and leveraging the autoscaler are the primary means of scaling out. Additionally, schema optimization like interleaved tables can improve data access patterns and reduce latency, helping address performance concerns.
- A. Correct.
Correct: Increasing the number of nodes is a key method for scaling out in Cloud Spanner as it allows more resources to be allocated to handle the increased workload.
- B. Incorrect.
Incorrect: Cloud Spanner does not operate on virtual machines where you can upgrade CPU or memory configurations. The scaling mechanism involves adding nodes, not upgrading hardware.
- C. Incorrect.
Incorrect: Sharding is not required in Cloud Spanner as it is a horizontally scalable, distributed database that automatically handles data partitioning across nodes.
- D. Correct.
Correct: Adjusting the schema, such as using interleaved tables, can improve data locality and reduce latency, which is crucial for optimizing performance in a distributed database.
- E. Correct.
Correct: Cloud Spanner's autoscaler can dynamically adjust the number of nodes based on traffic, ensuring efficient use of resources and maintaining performance during peak loads.