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!
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.