Simultaneous executions limit in google apps script
Asked Answered
J

2

5

I am trying to evaluate Google Apps Script (GAS) as one of the component in my overall SaaS. But, I see there is quota limits.

https://developers.google.com/apps-script/guides/services/quotas#current_limitations

Can someone explain what "Simultaneous executions" stands for? Is it 30 Simultaneous executions per a script? Or 30 Simultaneous executions per an account?

Jugoslavia answered 30/10, 2020 at 13:7 Comment(0)
H
8

I think it's per account. This is important when publishing web apps. When set to execute as "Me", you're limited to 30 simultaneous executions of all users, since they all run as "Me". But if set to execute as "user accessing the web app", then each user gets 30 simultaneous executions. Refer @Tanaike's answer

This also makes sense in case of add-on, where a single script project is published to execute as many users. If simultaneous executions of 30 applies per script, then a add-on could only have 30 users, which is certainly not the case.

Related Error messages from Google documentation:

Script invoked too many times per second for this Google user account. This indicates that the script began executing too many times in a short period. It most commonly occurs for custom functions that are called repeatedly in a single spreadsheet. To avoid this error, code your custom functions so that they only need to be called once per range of data, as explained in the guide to custom functions.

There are too many scripts running simultaneously for this Google user account. This indicates that you have too many scripts executing at once, although not necessarily the same script. Like the exception above, this most commonly occurs for custom functions that are called repeatedly in a single spreadsheet.

Notice both error messages end in "for this Google user account"

Comments from Google/Issuetracker links:

In almost all cases, Google representative says "for account". You may also create a new issue in the issuetracker for explicit documentation or clarification.

Heehaw answered 30/10, 2020 at 13:49 Comment(3)
I was under the impression that if you have it set up as user accessing the web that you could have up to 30 users per project. They use the term script but I think they mean project. It’s always been a bit ambiguous to me and I’d like to see Google docs clear it up.Platter
@Platter I think that's a different limitation - users per project. OP is talking about "simultaneous" executions . I agree though google should clear it up.Heehaw
I don’t think so. I’m talking about simultaneous executions occasionPlatter
C
0

So initially, I was concerned about hitting this upper limit of 30-concurrent-actions leading to a poor user experience. However, if you break it down math-wise? Here's the reality:

30 actions / second translates into 1800/minute, or 108,000/hour.

To see how close you are to that upper limit? You could simply check the version history of your Google Sheet spreadsheet to see how many operations are taking place per hour. Once you start to hit the several-thousand-per-hour point on a consistent basis? Only THEN are you at a point where MAYBE you'll start running into so many operations taking place simultaneously that it could degrade the user experience. In which case, it may be time to migrate to a more robust solution that can handle more scale and concurrency.

The exception to using that crude approach would be if your actions don't happen at random times; but instead, in response to certain events (like lots of social media posts in response to a celebrity post), at specific peak times or times of day (like some kind of calendar scheduling app or something), etc. But if your user actions are distributed at somewhat random points in the day, that crude "check your Google Sheet version history" approach can help you to identify when it's ACTUALLY time to start migrating to a more robust database, vs. prematurely optimizing and over-engineering for a scale + volume of usage that simply isn't there yet for your product.

Cutback answered 20/3 at 5:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.