Professional Cloud Developer · Domain 1: Designing highly scalable, secure, and reliable cloud-native applications · 32% of the exam
Task 1.3: Storing and accessing data.
Choosing a storage system by volume and performance, schema design for AlloyDB, Spanner, Bigtable and Firestore, eventual and strong consistency across the data services, Cloud Storage signed URLs, and writing data to BigQuery for analytics and AI/ML.
Study it
Choosing a data store and designing schemas for AlloyDB, Spanner, Bigtable and Firestore
Cloud Storage signed URLs and writing data to BigQuery
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the Google Cloud documentation page that proves it.
Question 1 · choose 1
A telemetry service will write about 8,000 small objects per second to a new Cloud Storage bucket, with names like 2026-11-16T10:15:03.412Z-<uuid>.json. Load tests show rising latency and errors while the bucket scales up. What should the team change in its design?
AKeep the timestamp first and make the random suffix after it longer
BPut a short hash, such as the first characters of an MD5 of the name, before the timestamp
CSend the full 8,000 writes per second from the first minute so that the bucket scales faster
DUpload each object as a parallel composite upload
Show the answer and why
AKeep the timestamp first and make the random suffix after it longer
Incorrect
Randomness after a sequential prefix is not as effective, because requests still crowd the same name range.
BPut a short hash, such as the first characters of an MD5 of the name, before the timestamp
Correct
Sequential names slow the auto-scaling of an index range; a hashed prefix spreads requests across ranges.
CSend the full 8,000 writes per second from the first minute so that the bucket scales faster
Incorrect
Above about 1,000 writes per second, the rate should rise gradually, no faster than doubling every 20 minutes.
DUpload each object as a parallel composite upload
Incorrect
Composite uploads split one large file into parts; they don't change how object names spread the load.
A bucket starts with capacity for about 1,000 object writes per second and scales up from there, so higher rates should ramp up gradually. Auto-scaling of an index range is slowed when names are sequential, such as names that start with a timestamp. Adding a hash value before the sequence number or timestamp, for example the first characters of the name's MD5 hash, spreads the requests and keeps a high request rate possible.
A product page shows a like counter. Today each like runs a Firestore transaction, through the Python server client library, that reads the product's single counter document and writes the incremented value. The database is a Standard edition database with its default concurrency settings. During launches, hundreds of likes per second arrive for one product, and the like requests slow down and fail. How should the team redesign the counter?
AUse 10 shard documents; each like atomically increments one random shard without reading the others, and the page sums the shards
BKeep the single counter document, but replace the transaction with an atomic increment in a plain update that reads nothing
CUse 10 shard documents; each like runs a transaction that reads all 10 shards and increments the lowest one
DKeep the single counter document and let the client library retry the transaction more times before it gives up
Show the answer and why
AUse 10 shard documents; each like atomically increments one random shard without reading the others, and the page sums the shards
Correct
Shards spread the writes over several documents, and increments that read nothing take no locks that would block the other shards.
BKeep the single counter document, but replace the transaction with an atomic increment in a plain update that reads nothing
Incorrect
A single document still can't be updated at an unlimited rate, so frequent increments to it keep contending.
CUse 10 shard documents; each like runs a transaction that reads all 10 shards and increments the lowest one
Incorrect
Here a transaction locks every document it reads, so each like blocks writes to all 10 shards and the likes contend again.
DKeep the single counter document and let the client library retry the transaction more times before it gives up
Incorrect
More attempts don't raise the rate at which one document can be updated.
Firestore can't update a single document at an unlimited rate, so a counter that gets frequent increments needs a distributed counter: shard documents whose values are summed, where write throughput grows with the number of shards. How the shards are written matters too. A Standard edition database defaults to pessimistic concurrency, which the server client libraries follow: a transaction places locks on the documents it reads, and those locks block other transactions and writes to them. Incrementing one random shard without reading the others keeps the likes from blocking each other.
A Bigtable instance has clusters in us-east1 and us-west1. The settings API saves a user's preferences, and the page that reloads right after reads them back; both go through an app profile with multi-cluster routing to any cluster. Users sometimes see their old settings right after saving. Which change gives these users back what they just wrote?
AAdd nodes to both clusters so that replication between them keeps up
BSend the writes through a single-cluster profile and keep the reads on the multi-cluster profile
CSend these reads and writes through an app profile with single-cluster routing to one cluster
DAdd a third cluster in us-central1 to the multi-cluster profile
Show the answer and why
AAdd nodes to both clusters so that replication between them keeps up
Incorrect
Replication between clusters has some latency and stays eventually consistent whatever the node count.
BSend the writes through a single-cluster profile and keep the reads on the multi-cluster profile
Incorrect
A read can still reach the other cluster before the write has been replicated there.
CSend these reads and writes through an app profile with single-cluster routing to one cluster
Correct
Single-cluster routing gives read-your-writes consistency, because reads and writes reach the same cluster.
DAdd a third cluster in us-central1 to the multi-cluster profile
Incorrect
Reads and writes that reach different clusters remain eventually consistent.
Bigtable replication is eventually consistent: reads and writes to different clusters can disagree for a while. With single-cluster routing, Bigtable can provide read-your-writes consistency, as long as each app profile that the workload uses routes to the same cluster. Adding capacity or clusters doesn't change the consistency model.
A Cloud Run backend gives browsers a URL for uploading an avatar to
avatars/USER_ID.png in the bucket acme-avatars. It creates the URL as the
service account uploads-signer:
url = blob.generate_signed_url(
version="v4",
expiration=datetime.timedelta(minutes=15),
method="PUT")
The only grant on the bucket for that account is:
gcloud storage buckets add-iam-policy-binding gs://acme-avatars \
--member=serviceAccount:uploads-signer@acme.iam.gserviceaccount.com \
--role=roles/storage.objectCreator
First uploads work. When a user replaces an avatar, the PUT to a freshly
signed URL fails with 403. What should the team change?
AGrant each user's Google account the Storage Object User role on the bucket
BGrant uploads-signer the Storage Object User role on the bucket in place of Storage Object Creator
CAlso grant uploads-signer the Storage Object Viewer role on the bucket
DHave the browser delete the old avatar first, with a second URL that uploads-signer signs for a DELETE request
Show the answer and why
AGrant each user's Google account the Storage Object User role on the bucket
Incorrect
Anyone who has the URL can use it, with or without an account; the permission that counts is that of the account that signed it.
BGrant uploads-signer the Storage Object User role on the bucket in place of Storage Object Creator
Correct
The signing account must be allowed to make the request, and Storage Object User covers updating objects, which Storage Object Creator doesn't.
CAlso grant uploads-signer the Storage Object Viewer role on the bucket
Incorrect
Viewer adds read access only; the account still can't overwrite objects.
DHave the browser delete the old avatar first, with a second URL that uploads-signer signs for a DELETE request
Incorrect
Storage Object Creator doesn't give permission to delete objects either, so that request fails too.
A signed URL lets anyone who has it make the specified request while it is active, whether or not they have an account, and the account that generates it must have sufficient permission to make that request. Storage Object Creator allows creating objects but doesn't give permission to view, delete or overwrite them, so replacing an existing avatar fails. Storage Object User gives access to create, read, update and delete objects.
A team plans to keep a 1.2 TB working set of product data in a managed Redis cache so that its API can read it with very low latency. It proposes a single Memorystore for Redis instance. What should the team consider?
AMemorystore for Redis Cluster
BA single Memorystore for Redis instance with five read replicas
CA single Memorystore for Redis instance sized at 1.2 TB
DTwo separate Memorystore for Redis instances with identical data
Show the answer and why
AMemorystore for Redis Cluster
Correct
A Memorystore for Redis instance has a maximum primary size of 300 GB, while a cluster spreads the key space across shards.
BA single Memorystore for Redis instance with five read replicas
Incorrect
Read replicas serve reads; they don't raise the 300 GB primary size limit.
CA single Memorystore for Redis instance sized at 1.2 TB
Incorrect
A Memorystore for Redis instance can scale only up to 300 GB.
DTwo separate Memorystore for Redis instances with identical data
Incorrect
Copying the same data into each instance doesn't raise the 300 GB limit of either one.
Memorystore for Redis instances scale up to a maximum primary size of 300 GB, and read replicas don't raise that limit. Memorystore for Redis Cluster instances are made of shards, each containing a subset of the key space, so the cluster's capacity grows with the number of shards provisioned.
A developer generates a V4 signed URL for an object and builds the link on the JSON API host, as https://storage.googleapis.com/storage/v1/b/BUCKET/o/OBJECT?<signature parameters>. Downloads with the link fail. What is wrong?
ASigned URLs work only for users who sign in with a Google account
BThe URL needs an OAuth access token in the Authorization header as well
CSigned URLs can be used only through XML API endpoints, not JSON API ones
DSigned URLs are limited to objects smaller than 5 GB
Show the answer and why
ASigned URLs work only for users who sign in with a Google account
Incorrect
A signed URL works for whoever holds it, with or without an account.
BThe URL needs an OAuth access token in the Authorization header as well
Incorrect
The signature itself authenticates the request; no token is added.
CSigned URLs can be used only through XML API endpoints, not JSON API ones
Correct
The signed URLs page states that they access Cloud Storage resources only through XML API endpoints.
DSigned URLs are limited to objects smaller than 5 GB
Incorrect
The stem gives no object size, and the signed URLs page names no such limit; it rules out the JSON API endpoint the link uses.
Signed URLs use signatures to give time-limited access to a specific Cloud Storage resource, and signatures are specific to the Cloud Storage XML API. A signed URL can therefore be used only through XML API endpoints, such as https://storage.googleapis.com/BUCKET/OBJECT, not through the JSON API.
A chat app stores each room as a document in the rooms collection and each message in a messages subcollection of its room. A cleanup job deletes the document of every closed room. Weeks later, storage keeps growing and old messages can still be read by their references. Why?
ADeleted documents stay readable until a TTL policy removes them
BDeleting a document doesn't delete its subcollections, so the messages remain
CThe messages were written to a different database than the rooms
DCollections hold their documents until the collection is deleted explicitly
Show the answer and why
ADeleted documents stay readable until a TTL policy removes them
Incorrect
The room documents are gone; the messages stay because they were never deleted.
BDeleting a document doesn't delete its subcollections, so the messages remain
Correct
Subcollection documents must be deleted separately, for example by reading and deleting them in batches.
CThe messages were written to a different database than the rooms
Incorrect
A subcollection belongs to its document in the same database.
DCollections hold their documents until the collection is deleted explicitly
Incorrect
Collections don't need to be created or deleted; a collection with no documents simply doesn't exist.
In Firestore, a subcollection is a collection associated with a specific document. Deleting a document does not delete its subcollections, and the subcollection documents can still be accessed by reference. To remove them, read the documents of the subcollection and delete them, for example in batches.