Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Google Cloud Certified Professional Cloud Developer · Google Cloud
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The best answer is A. Write a shutdown script that uses inter-process signals to notify the application process to disconnect from the database. Here's why: Inter-process Signals: Signals are a standard mechanism in Unix-like systems for communicating between processes. They are a reliable and efficient way to notify the application process that a shutdown is imminent. Graceful Shutdown: Using signals allows the application to gracefully disconnect from the database, ensuring data integrity and preventing potential data loss. The application can handle the signal, perform necessary cleanup tasks, and then exit gracefully.
Let's analyze why the other options are less suitable: B. Broadcast message to users: This approach is not a reliable way to initiate a graceful shutdown. It relies on user interaction and might not be effective if users are not actively using the application. C. Write a file for polling: This approach is less efficient and introduces a delay. The application needs to poll the file every five minutes, which can introduce latency and might not be timely enough for a graceful shutdown. D. Publish a message to the Pub/Sub topic: This approach is not ideal because it introduces additional complexity and relies on the application's ability to process messages from the same topic it's subscribing to. It also might not be a reliable way to ensure a timely shutdown.
A. Write a shutdown script that uses inter-process signals to notify the application process to disconnect from the database. In the scenario of using preemptible virtual machines for running an application that interacts with a database, a graceful shutdown is essential to ensure data consistency and prevent potential issues like incomplete transactions. A shutdown script utilizing inter-process signals is an efficient and direct way to manage this process.