Bird
Raised Fist0
GCPcloud~20 mins

Cloud Spanner for global distribution in GCP - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Cloud Spanner Global Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
How does Cloud Spanner handle global consistency?

Cloud Spanner is designed for global distribution. What mechanism does it use to ensure strong consistency across regions?

AIt uses a global lock manager to lock data before any transaction.
BIt uses TrueTime API to assign timestamps and coordinate transactions globally.
CIt replicates data asynchronously and resolves conflicts later.
DIt relies on client-side conflict detection and retries.
Attempts:
2 left
💡 Hint

Think about how Spanner achieves external consistency with minimal latency.

❓ Architecture
intermediate
2:00remaining
Choosing Spanner instance configuration for global users

You have users in North America, Europe, and Asia. You want low latency reads and writes globally. Which Spanner instance configuration is best?

AMulti-region instance with nodes in US, Europe, and Asia regions.
BSingle-region instance in US-central1 only.
CSingle-region instance in US-central1 with multi-region replicas.
DMulti-region instance with nodes only in US and Europe.
Attempts:
2 left
💡 Hint

Consider where your users are and how Spanner distributes data.

❓ security
advanced
2:00remaining
Securing data in Cloud Spanner for global distribution

Which option correctly describes how Cloud Spanner secures data at rest and in transit globally?

AData is encrypted at rest using Google-managed keys only; in transit encryption is optional.
BData is encrypted only in transit; at rest it is stored unencrypted for performance.
CData is encrypted at rest and in transit only within a single region.
DData is encrypted at rest using customer-managed keys and in transit using TLS.
Attempts:
2 left
💡 Hint

Think about Google Cloud's default encryption and customer control options.

✅ Best Practice
advanced
2:00remaining
Optimizing schema design for global Cloud Spanner instances

Which schema design practice helps reduce latency and improve performance in a globally distributed Cloud Spanner instance?

AAvoid primary keys to allow flexible querying across regions.
BUse wide tables with many nullable columns to reduce joins.
CUse interleaved tables to colocate related data physically.
DUse many small tables with no foreign keys to simplify replication.
Attempts:
2 left
💡 Hint

Think about how data locality affects distributed database performance.

🧠 Conceptual
expert
2:00remaining
Impact of TrueTime uncertainty on transaction commit latency

Cloud Spanner uses TrueTime with bounded uncertainty for global consistency. How does increasing TrueTime uncertainty affect transaction commit latency?

AHigher uncertainty increases commit latency because Spanner waits longer to ensure consistency.
BHigher uncertainty decreases commit latency by allowing faster commits.
CTrueTime uncertainty has no effect on commit latency as commits are asynchronous.
DHigher uncertainty causes Spanner to abort more transactions but does not affect latency.
Attempts:
2 left
💡 Hint

Consider why Spanner waits before committing transactions.

Practice

(1/5)
1. What is the main benefit of using Cloud Spanner's global distribution feature?
easy
A. It keeps applications fast and reliable by storing data across multiple regions.
B. It reduces the cost of storage by using local disks only.
C. It automatically deletes old data to save space.
D. It limits access to data to a single region for security.

Solution

  1. Step 1: Understand global distribution purpose

    Cloud Spanner stores data in multiple regions to improve speed and reliability.
  2. Step 2: Compare options

    Only It keeps applications fast and reliable by storing data across multiple regions. correctly describes the benefit of global data storage for performance and reliability.
  3. Final Answer:

    It keeps applications fast and reliable by storing data across multiple regions. -> Option A
  4. Quick Check:

    Global data storage = fast and reliable apps [OK]
Hint: Global means data spread worldwide for speed and reliability [OK]
Common Mistakes:
  • Thinking global distribution saves storage cost
  • Believing data is deleted automatically
  • Assuming data is limited to one region
2. Which of the following is the correct way to specify a multi-region configuration in Cloud Spanner?
easy
A. multi_region_config = "europe-west1"
B. multi_region_config = "us-central1"
C. multi_region_config = "asia-east1"
D. multi_region_config = "nam3"

Solution

  1. Step 1: Identify multi-region config names

    Cloud Spanner uses specific multi-region config names like "nam3" for North America multi-region.
  2. Step 2: Check options

    Only A is a valid multi-region config. Options B, C, and D are single-region names.
  3. Final Answer:

    multi_region_config = "nam3" -> Option D
  4. Quick Check:

    Multi-region config uses names like nam3 [OK]
Hint: Multi-region configs have short codes like nam3, not single region names [OK]
Common Mistakes:
  • Using single region names instead of multi-region codes
  • Confusing region names with zone names
  • Misspelling multi-region config strings
3. Given this Cloud Spanner instance configuration:
instance_config = "nam3"
nodes = 3

What is the expected behavior of this setup?
medium
A. Data is globally distributed across North America with 3 nodes handling requests.
B. Data is stored in a single region with 3 nodes for processing.
C. Data is stored only in Europe with 3 nodes.
D. Data is stored in Asia with 3 nodes but no replication.

Solution

  1. Step 1: Interpret instance_config "nam3"

    "nam3" is a multi-region config for North America, so data is distributed across multiple regions there.
  2. Step 2: Understand nodes setting

    3 nodes means the instance has 3 processing units to handle workload.
  3. Final Answer:

    Data is globally distributed across North America with 3 nodes handling requests. -> Option A
  4. Quick Check:

    nam3 = North America multi-region + 3 nodes [OK]
Hint: Multi-region config + nodes = distributed data with processing power [OK]
Common Mistakes:
  • Assuming single region storage with multi-region config
  • Ignoring the meaning of nodes
  • Confusing region names with multi-region configs
4. You configured a Cloud Spanner instance with instance_config = "nam3" but your app experiences high latency in Europe. What is the likely cause?
medium
A. The instance_config "nam3" is invalid and causes errors.
B. You need to increase the number of nodes to reduce latency.
C. The multi-region config "nam3" only covers North America, not Europe.
D. Cloud Spanner does not support multi-region configurations.

Solution

  1. Step 1: Understand "nam3" coverage

    "nam3" is a multi-region config limited to North America regions only.
  2. Step 2: Analyze latency cause

    High latency in Europe happens because data is not stored close to European users.
  3. Final Answer:

    The multi-region config "nam3" only covers North America, not Europe. -> Option C
  4. Quick Check:

    nam3 excludes Europe, causing latency there [OK]
Hint: Check if multi-region config covers your app's user locations [OK]
Common Mistakes:
  • Assuming multi-region covers all continents
  • Thinking node count fixes geographic latency
  • Believing "nam3" is invalid
5. You want to deploy a Cloud Spanner instance that serves users in Asia, Europe, and North America with low latency. Which configuration should you choose?
hard
A. Use a single-region config in Asia with 5 nodes.
B. Use the multi-region config "nam-eur-asia1" with enough nodes.
C. Use multiple single-region instances in each continent.
D. Use the multi-region config "nam3" with 3 nodes.

Solution

  1. Step 1: Identify multi-region config covering Asia, Europe, North America

    "nam-eur-asia1" is a multi-region config spanning these continents.
  2. Step 2: Understand node allocation

    Choosing enough nodes ensures capacity and low latency across regions.
  3. Step 3: Compare other options

    Single-region configs or multiple instances increase complexity or limit coverage.
  4. Final Answer:

    Use the multi-region config "nam-eur-asia1" with enough nodes. -> Option B
  5. Quick Check:

    nam-eur-asia1 covers all needed continents [OK]
Hint: Pick multi-region config covering all user continents [OK]
Common Mistakes:
  • Choosing single-region config for global users
  • Using nam3 which excludes Europe and Asia
  • Deploying multiple instances instead of one multi-region
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard