
Answer-first summary for fast verification
Answer: Store the session information in Memorystore for Redis or Memorystore for Memcached, and store the shopping cart information in Firestore.
Google recommends using Memorystore (Redis/Memcached) for session storage due to its low-latency, in-memory capabilities, which are ideal for ephemeral session data. Firestore is suitable for shopping cart data as it provides persistent, scalable storage with structured querying, ensuring carts are retained even after sessions expire. Option A misuses Pub/Sub (a messaging service) for sessions. Option B uses Cloud Storage (object storage) inefficiently for cart data. Option C relies on self-managed Compute Engine instances, which contradicts managed service best practices. Option D correctly uses Memorystore for sessions and Firestore for cart data.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How should you store user session and shopping cart data in an ecommerce platform to persist across logins (after 30-minute inactivity timeouts) while adhering to Google Cloud best practices?
(Assume the platform requires user authentication, and cart data must survive session expiration.)
Key considerations:
- Session management
- Cart persistence
- Google-recommended storage solutions
Key considerations:
- Session management
- Cart persistence
- Google-recommended storage solutions
A
Store the session information in Pub/Sub, and store the shopping cart information in Cloud SQL.
B
Store the shopping cart information in a file on Cloud Storage where the filename is the SESSION ID.
C
Store the session and shopping cart information in a MySQL database running on multiple Compute Engine instances.
D
Store the session information in Memorystore for Redis or Memorystore for Memcached, and store the shopping cart information in Firestore.
No comments yet.