I am writing an Apps Script(to process emails, Tasks and Calendar events) and want to deploy it as a web App.
The App will run in the context of the user who runs it. The App will be used by more than 10k+ users and probably even more.
Before I distribute this to users I wanted to know if there is limit on number of concurrent hits a web App can have?
Will the limit if users running the web app script would account in this case or my(script owner) limits would apply? Can I assume that it can scale enough to meet needs of 10k+ users, provided their limits as described here are not reached? Any idea or experience related related to it?
A single execution of Apps script can last no longer than 6 minutes and you're hitting this limit.
The maximum execution time varies based on the type of your Google Account. If you are running your Apps Script code inside a Gmail account, your functions can run for 6 minutes before it will be terminated.
Apps Script is free to use, and all you need to get started is a Google account. So, if you use Gmail, you can start coding in Apps Script in your browser, for free, right now. If you use Sheets, you can start. If you use Docs, you can start.
To share a container-bound project, you simply share the parent container file. For example, if you have a script bound to a Google Sheet, you can make someone an editor of the script by making them an editor of the Google Sheet.
If you are looking for the solution of this question yet, how about this? I measured the number of concurrent connections for Web Apps using the fetchAll method which can work the asynchronous processing. The flow is as follows.
var workers = 10; // Number of workers
var object = [];
for (var i = 0; i < workers; i++) {
object.push({
"url": "https://script.google.com/macros/s/#####/exec?key=ok",
"method": "get",
"muteHttpExceptions": true,
});
}
var startTime = Date.now();
var res = UrlFetchApp.fetchAll(object);
var endTime = Date.now();
var elapsedTime = (endTime - startTime) / 1000;
var error = res.filter(function(e){return ~e.getContentText().indexOf("Error")});
var result = [[workers, elapsedTime, (error.length > 0 ? error.length : 0)]]; // This is imported to Spreadsheet
function doGet(e) {
if (e.parameter.key == "ok") {
var val = JSON.stringify({
date: new Date().getTime().toString(),
});
Utilities.sleep(1000);
return ContentService.createTextOutput(val).setMimeType(ContentService.MimeType.JSON);
} else {
return;
}
}
This figure shows the number of returned errors with the increase in the number of workers. From this figure, it is found that there are no errors under 30 workers, and also when the workers are more than 30, the errors are included in the returned results. The error message is Service invoked too many times in a short time: exec qps. Try Utilities.sleep(1000) between calls.
. This means that the maximum effective-number of workers who connect with the concurrent access is 29 for Web Apps. If the access time of workers is separated by more than 1 second, no error occurs.
"Execute the app as:" : Me
, the scripts of Web Apps is run as owner. So the quota of owner is used."Execute the app as:" : User accessing the web app
, the scripts of Web Apps is run as each user. So the quota of each user is used.If this was not what you want, I'm sorry.
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