Question: What is the best way to deploy a Google Apps Script as a web app to receive a high volume of POST requests from users?
Context:
As my user base expands, however, I am concerned I may run into the "30 simultaneous executions/user" limit pretty quickly, as noted in the official Google Scripts documentation: https://developers.google.com/apps-script/guides/services/quotas
I know the general recommendation is to have the GAS deployment execute as "User accessing this app," but I don't understand how that configuration would work in conjunction with POST requests sent from a Chrome Extension.
CodePudding user response:
It depends on what exactly you're trying to do, but you may simply be running into the limits of Apps Script's intended usage. In my experience, Google doesn't make exceptions for Apps Script quota limits unlike GCP API quotas, which do have a request increase process, which tells us that they probably don't really want you using Apps Script at a large scale like this.
You still have a couple options. First make sure that you really need to run the app as yourself, though I assume you already know this and are probably accessing APIs with your own account or something similar.
Also, 30 simultaneous executions doesn't necessarily mean 30 users max, since not all of them will be sending requests all the time. If your app only calls the script occasionally you can get away with more than that, especially with a retry strategy like exponential backoff. A somewhat dodgy approach could also be to set up multiple scripts and have your extension randomly choose between them along with a backoff strategy. Note that these scripts would have to be from different accounts because the 30 simultaneous executions are for all scripts within your account.
If you expect your user base to really grow, as in commercial app levels, you'll need to look at a reliable solution like App Engine or your own server that connects to the Google APIs. Apps Script is not suited to something like that.