I have been testing Google Compute VM instances with custom startup scripts. I wanted to figure out how long my startup scripts were taking to initialize an instance.
The VM instance has Debian 9 Stretch as the OS. Knowing the OS I can now lookup the log file locations.
For Debian 9 the startup script is recorded to /var/log/daemon.log. It is also recorded in /var/log/syslog. You can also view the startup script output with the command: “sudo journalctl -u google-startup-scripts.service.
You can also get the startup script output from the VM instance console. Use this command: “gcloud compute instances get-serial-port-output instance_name –zone zone_name > console.log”. In console.log search for the string “Starting Google Compute Engine Startup Scripts”. The startup scripts end with “Finished running startup scripts”.
The log showed that the startup scripts started at 10:44:43 and ended at 10:45:44. Total time 61 seconds. This value helps me correctly configure an Instance Group’s “Cool-down period” and “Initial delay”.
I then looked at the Google Console VM instances screen to get the VM Creation time. This showed 10:44:35. This makes the total time to start an instance at 69 seconds. This does not include the time for all the application services to get to the ready state, but does give me better numbers. The Google Instance Group default value for Cool-down period (default 60 seconds) is too short for my test case.
Google defines “Cool-down period”:
How long to wait before collecting information from a new instance. This should be at least the time it takes to initialize the instance. To find the minimum, create an instance from the same image and note how long it takes to start.
Google the defines “Initial delay”:
The time to allow an instance to boot and applications to fully start before the first health check.
I design software for enterprise-class systems and data centers. My background is 30+ years in storage (SCSI, FC, iSCSI, disk arrays, imaging) virtualization. 20+ years in identity, security, and forensics.
For the past 14+ years, I have been working in the cloud (AWS, Azure, Google, Alibaba, IBM, Oracle) designing hybrid and multi-cloud software solutions. I am an MVP/GDE with several.
Leave a Reply