nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #129

Your team is developing an ecommerce platform for your company. Users will log in to the website and add items to their shopping cart. Users will be automatically logged out after 30 minutes of inacti

The correct answer is D. Store the session information in Memorystore for Redis or Memorystore for Memcached, and. Google recommends using Memorystore for Redis or Memcached for session data because session information is ephemeral, frequently accessed, and benefits from the low-latency, in-memory characteristics these services provide. Session data does not need durable persistence between a

Designing data storage options for cloud-native applications

Question

Your team is developing an ecommerce platform for your company. Users will log in to the website and add items to their shopping cart. Users will be automatically logged out after 30 minutes of inactivity. When users log back in, their shopping cart should be saved. How should you store users' session and shopping cart information while following Google-recommended best practices?

Options

  • AStore the session information in Pub/Sub, and store the shopping cart information in Cloud SQL.
  • BStore the shopping cart information in a file on Cloud Storage where the filename is the SESSION
  • CStore the session and shopping cart information in a MySQL database running on multiple
  • DStore the session information in Memorystore for Redis or Memorystore for Memcached, and

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    16% (4)
  • D
    72% (18)

Explanation

Google recommends using Memorystore for Redis or Memcached for session data because session information is ephemeral, frequently accessed, and benefits from the low-latency, in-memory characteristics these services provide. Session data does not need durable persistence between application restarts. The shopping cart, however, must persist beyond a session (users log out and return to find their cart intact), so it belongs in a durable persistent store (implied in answer D). Option A uses Pub/Sub for session storage, which is a messaging service not suited for key-value session lookups. Option B stores cart data in filenames on Cloud Storage, which is an anti-pattern and unscalable. Option C runs a self-managed MySQL cluster, which is not a managed service and increases operational overhead.

Topics

#Session Management#Memorystore#Database Selection#Application Design

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice