Google App Engine Standard or Flexible environment

2019-02-08 22:46发布

问题:

I am stuck in deciding between choosing Google App Engine Standard Vs. Flexible environment for a real world production. I want to use Java definitely. Need to use Firebase(latest version) for Authentication and Push notification; I'm not sure whether new Firebase is compatible with standard or flexible.

per the caution note in the following link, my impression is that recent Firebase is compatible is with Flexible Environment only.

https://cloud.google.com/solutions/mobile/firebase-app-engine-android-studio

回答1:

All things being equal any standard environment app can also run in a flexible environment with minimal app changes. The reverse is not true - the standard environment restrictions are stricter than those for the flexible environment (hence the flexible in its name).

UPDATE: the above is not correct, the language specific section of the Migrating an Existing App Engine App guide should be checked for which standard env APIs are explicitly listed as compatible or incompatible. In some cases that could clarify the decision right away. Assuming for the remaining of the answer that the choice between environments remains open after this check.

So - to get unstuck - I'd initially shoot for the standard environment (simpler to setup/manage and also potentially free, depending on the app's usage) and only decide to switch to flexible-only env if/when I hit an unavoidable issue caused by one of a standard environment restrictions and which is not an issue in the flex environment. If no such issue is hit you practically maintain the option to switch between the 2 deployment options as you desire.

As for your impression from the tutorial doc - I think it's unfounded, based on the Costs section...

Both Firebase and App Engine have free levels of usage. If your usage of these services is less than the limits specified in the Firebase free plan and the App Engine free quota, there is no charge for doing this tutorial.

... in combination with the Pricing row Comparing environments table...

... as the standard env has a free daily Instance hours quota but the Compute Engine Pricing uses the Machine type billing model and doesn't have a free quota except for the initial limited free trial.

Which overall tells me that the standard environment is used in the tutorial :)

Confirmed in the Configuring the App Engine backend to use manual scaling section as the app's config doesn't have the <vm>true</vm> setting used to select the flexible environment.



回答2:

Your preference should be app engine standard environment for the time being, unless you specifically need a feature only offered in flexible. Currently, there is very little documentation to go with Flexible app engine, and converting nearly any app from one to the other is NOT a simple task.

Anything you read that says "its easy to convert from standard to flexible" or vice versa is from BEFORE december 6'th, when vm:true was deprecated (along with all of the compat runtimes which let you use standard code on flexible app engine). Flexible now has it's own libraries for most things, and it's different enough to require nearly a complete re-write of many of your methods.

For example, when I converted my cloud storage controller to flexible, not a single line of code was useful beyond method names as the new library primarily utilizes Blobs instead of StorageObjects. (java)