Old versions of Managed VMs

236 views
Skip to first unread message

Jeff Schnitzer

unread,
Sep 15, 2015, 7:15:10 PM9/15/15
to Google App Engine
I have a python app on a Managed VM which I deploy with:

gcloud preview app deploy app.yaml --remote --set-default

It's set to manual scaling, instances 1.

It appears that every time I deploy it, the old instance stick around (and get billed for). Even deleting the old versions from the appengine console didn't shut down the compute engine instances. I had to figure out which compute engine instance was my "live" one and delete all the others from the Compute Engine part of the console.

Is this supposed to work this way or is there a better workflow? I just want to deploy the new version and have the old version go away... like regular App Engine.

Jeff

Christian F. Howes

unread,
Sep 16, 2015, 3:41:45 PM9/16/15
to Google App Engine, je...@infohazard.org
Hi Jeff,

From what i can see managed VMs behave much like app engine modules that use backend instance class and manual scaling - which means they stay live when you deploy a new version, and even after setting default.

I'm still using the "old" app engine console, and when i delete an old managed VM instance (or even click the stop link) it will shut down.  It does take longer then for an app engine instance - sometimes 10-15mins, but i think that has to do with the managed VM health-check timing and shutdown process (or perhaps i just have mis-implemented my shutdown handlers on my managed VMs).

I hope that helps.

Christian

Michael Spainhower

unread,
Sep 16, 2015, 4:03:13 PM9/16/15
to Google App Engine, je...@infohazard.org
I am using managed vms and also have the issue of non-default versions running residual instances.  However, I do not experience the issue you have described where the instances remain even after deleting the non-default versions.

Are you using a standard runtime or custom runtime (https://cloud.google.com/appengine/docs/managed-vms/#runtimes)?  The lifecycle (shutdown) request handling seems like a potential culprit, so that may be worth examining if you are using a custom runtime.  I am using a node custom Dockerfile and my app just returns a 200 on requests to `/_ah/stop` (https://github.com/home-buddy/express-appengine-handlers/blob/master/index.js#L18).  You can probably check your logs for requests to that URL to see if there are non-200 responses.

What version of the gcloud cli tool are you running?  While potentially unrelated to this issue, you may want to update it because I do not think `--remote` is an option anymore (implying you may need an update).

As an aside, I would love guidance on fixing the issue where every non-default version has instances running.  Perhaps this is the expected behavior since managed VMs is labeled as beta?

Jeff Schnitzer

unread,
Sep 16, 2015, 5:05:58 PM9/16/15
to Michael Spainhower, Google App Engine
Interesting. Maybe I just didn't wait long enough after deleting the nondefault versions.

Still, it's a small surprise that I have to prune old versions. With normal GAE, I leave those versions around so I can go back through the logs when necessary.

Jeff

Jason Collins

unread,
Sep 17, 2015, 3:54:34 PM9/17/15
to Google App Engine, sp...@homebuddy.io, je...@infohazard.org
Jeff, there is a tiny switch in the legacy console Versions tab that allows you to "stop" a managed VM. I believe this will delete the underlying VMs while still keeping your version and logs around. Big gotcha: you need to manually re-"start" the version to serve any traffic (regardless of your scaling configuration) - this has tripped me up a number of times.




I have not found the equivalent button in the new console, so I don't know how you'd achieve same there.

Also, this is still a rapidly evolving feature, so this advice is seriously time-limited! ;)

j

Michael Spainhower

unread,
Oct 4, 2015, 4:02:29 PM10/4/15
to Google App Engine
Could anyone from Google comment on whether there is a plan to fix this issue?  Versions that are not getting traffic really shouldn't have instances constantly running.  Only using (and paying for) the resources that you really need and use is one of the key value props of Google Cloud and GAE.

On Tuesday, September 15, 2015 at 7:15:10 PM UTC-4, Jeff Schnitzer wrote:

Michael Spainhower

unread,
Oct 5, 2015, 12:39:29 PM10/5/15
to Google App Engine
Ah, found the answer myself in the gcloud release notes at https://dl.google.com/dl/cloudsdk/release/RELEASE_NOTES

In a future Cloud SDK release, deployments that promote the new version
      to receive all traffic will stop the previous version by default.

Great to hear.  Thanks! 

Michael Sander

unread,
Mar 13, 2016, 9:51:51 PM3/13/16
to Google App Engine
Just ran into this issue today, and noticed that as of 3/9/2016 it was fixed. Time to do a "gcloud components update"
Reply all
Reply to author
Forward
0 new messages