Google Professional Cloud Developer Question 36
Single answerGoogle Cloud PlatformYou are developing a web application hosted on Google Cloud that requires user session management. Users must remain logged in during their active sessions, even if the application scales horizontally across multiple instances. Which approach is the most appropriate for managing user sessions in this scenario?
- A
Store session data in an in-memory store such as Redis and configure it for high availability.
- B
Use the local memory of the application instance to store session data.
- C
Store session data in a Google Cloud Storage bucket.
- D
Use Firebase Authentication to handle user sessions automatically.
Show answer and explanation
Correct answer: A
Explanation
For applications that scale horizontally, session data must be stored in a centralized and scalable solution. Using an in-memory store like Redis ensures high performance and availability. Local memory is not suitable as it leads to session inconsistency across instances. Google Cloud Storage is too slow for session management, and Firebase Authentication does not fully address the requirements of managing session state in this scenario.
- A. Correct.
This is the correct choice. An in-memory store like Redis can efficiently handle session data in a centralized manner, ensuring availability and scalability even when the application scales horizontally. Configuring Redis for high availability ensures fault tolerance.
- B. Incorrect.
Storing session data in the local memory of the application instance is not suitable for horizontally scaling applications because session data will not be shared between instances, leading to session inconsistency.
- C. Incorrect.
Google Cloud Storage is not designed for low-latency session management due to its slower read/write speeds compared to in-memory stores. It is better suited for storing files and large objects.
- D. Incorrect.
While Firebase Authentication is useful for managing user authentication, it does not directly handle user session state for custom applications. Additional logic would be required to manage session data.