Is there any limit on number of concurrent hits or simultaneous executions on Google App Script Web App
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.
- Deploy Web Apps.
- Connect to Web Apps by the asynchronous processing. At that time, the number of workers which are the number of connections is changed.
- Retrieve the number of error when the results are returned from Web Apps.
Sample scripts for this experiment :
Script for client side : Google Apps Script
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
Script for Web Apps side :
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;
}
}
Result :
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.
- If Web Apps is deployed as
"Execute the app as:" : Me
, the scripts of Web Apps is run as owner. So the quota of owner is used. - If Web Apps is deployed as
"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.
Reference :
- fetchAll method
If this was not what you want, I'm sorry.