GAE allows different restrictions depending on whether or not the code is running on a frontend instance or a backend instance. For example, it permits you to kick off long-running background threads on a backend, whereas this would timeout and throw a runtime exception if the code was running on a frontend instance.
I am very confused about how to engineer an app so that you know that only certain code executes on a backend instance (and not a frontend instance).
My understanding of how GAE works is that you upload your app (a WAR file) and that it scales (creates clustered instances of) that app as needed or until it exceeds a ceiling that you define (for budgeting, etc.).
But unless I'm mistaken, it doesn't allow you to upload different modules (multiple WARs) for the same app, and thus have 1 WAR to be ran on frontend instance, and another WAR to be ran on backend instance (to guarantee that you only run background threads on backends!).
So my question is: how do you develop, package and deploy GAE apps so that the right code always executes on the right instance? Tangential to this is the question of how to specify different long-running jobs be ran on specific backends. For instance if you have a background thread that should be cronned to run nightly at midnight, but you have 10 backends, wouldn't this mean you would have the same background thread kicking off on all ten instances every night? Obviously, there are situations where you only want 1 backend to run the job, and other instances when each backend should behave the same.
Again, it all comes back to: how do you make sure the right code deploys and executes on the correct instance? Thanks in advance!
Google App Engine provides four possible runtime environments for applications, one for each of four programming languages: Java, Python, PHP, and Go. The environment you choose depends on the language and related technologies you want to use for developing the application.
There are three scaling types by which Google controls how instances are created. Automatic: Dynamic as per requests. You can specify idle instances. Basic: Dynamic as per requests.
Front end instances They are the ones that are more limited, because any application that has only 60 seconds per request. Every application has a queue of requests, managed by the app instances.
The App Engine standard environment is based on container instances running on Google's infrastructure. Containers are preconfigured with one of several available runtimes. The standard environment makes it easy to build and deploy an application that runs reliably even under heavy load and with large amounts of data.
backends are addressable directly by name although they share the same code and servlets with other regular/frontend instances within your app.
ref: https://developers.google.com/appengine/docs/java/backends/overview
You can direct requests that need to run on a backend, to backendname.yourapp.appspot.com/someroute
You can also configure multiple backends in backends.xml (with different names) and using the same logic, send requests meant for specific backends to their corresponding uri.
Essentially the same code runs on all instances, but you can design you routing to direct specific requests to named backends instances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With