Memory hook: Stateless compute, explicit state, bounded work.
Must remember
- Choose Cloud Run for managed request/event containers, GKE for Kubernetes control and Compute Engine for VM-level requirements. Compare region, availability, scaling limits, startup time and operational effort.
- Keep durable state outside disposable instances. Session affinity can improve locality but should not be the only way a user session survives a restart; Memorystore can cache or externalize suitable session state.
- Define REST/gRPC contracts, authentication, rate limits, versioning and error behavior. API Gateway provides managed gateway capabilities; Apigee addresses broader API lifecycle and enterprise policy needs.
- Use Pub/Sub for decoupled messaging, Cloud Tasks for controlled task dispatch, Workflows for orchestration and Scheduler for time triggers. Eventarc connects matching events to receivers.
- Select schemas and stores from access patterns: relational joins and transactions, document access, row-key scans or analytical queries. Understand the selected service’s consistency and replication behavior.
- Signed Cloud Storage URLs grant time-limited access to a specific operation/resource. Treat them as bearer capabilities and keep sensitive URLs out of logs; retention locks can be irreversible.
Review details
Cloud Tasks dispatches work to a selected endpoint with controlled scheduling/rate and retries; Pub/Sub decouples publishers from independent subscribers. Neither guarantees exactly-once business effects without the application design. Use a stable operation ID for repeated requests and acknowledge only after durable work.
Cloud Storage object reads/writes/listing are strongly consistent, but public caches and permission propagation have separate behavior. Relational asynchronous replicas can lag; Bigtable multi-cluster routing must be chosen with consistency needs in mind. Use the service's transactions/preconditions to protect invariants instead of assuming all managed storage has identical semantics.
Choose under exam pressure
| Requirement | Choice and reason |
|---|---|
| An HTTP container should scale with traffic | Cloud Run with deliberate concurrency, limits and state handling. |
| A workflow must call several APIs with retries | Workflows with bounded retries and idempotent steps. |
Traps
- Session affinity does not make local memory durable.
- Asynchronous delivery can still duplicate a business operation unless the consumer is designed safely.
Active recall
1. When choose GKE over Cloud Run?
When Kubernetes-specific orchestration, networking or workload control is required.
2. What should an idempotency key identify?
One intended business operation across retries.
3. Why put an expiry on a signed URL?
To bound the time a bearer can use the delegated operation.
4. How choose a database?
Start with transactions, consistency, access pattern and scale rather than familiarity alone.
5. What does traffic splitting enable?
Gradual rollout, comparison and rollback between deployed versions.