Your app subscribes to a Pub/Sub topic and inserts rows into a database, running on Linux preemptible VMs. How should a shutdown script initiate a graceful shutdown?
Choose an answer
Tap an option to check your answer.
Correct answer: Write a shutdown script that uses inter-process signals to notify the application process to disconnect from the database..
Why this is the answer
The most effective way to initiate a graceful shutdown for an application on a Linux preemptible VM is by using inter-process signals. Signals like SIGTERM are standard mechanisms for telling a process to terminate gracefully, allowing it to clean up resources (like database connections) before exiting. This is a direct, efficient, and immediate method. Broadcasting messages to users is irrelevant to the application's internal shutdown process. Polling a file every five minutes is too slow and inefficient for a timely shutdown. Publishing a message to Pub/Sub and having the application read it introduces unnecessary latency and complexity, and doesn't guarantee the application will process it before being terminated, especially on a preemptible VM with a short shutdown notice.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed