Does having multiple Google Apps Script projects slow down execution time? - google-apps-script

I am creating a new Google Apps Script projects for clients of mine. These projects are only owned and managed by my single Google Account. These Apps Script projects are duplicates of each other with changes in document IDs. I have a total of 6 Apps Script projects, and I am looking to add 20 more clients (so 20 more projects).
Will this slow down the execution time on my end as well as my clients end? Does each project run on different servers? Does the amount of project on 1 Google Account play a role in execution speed?

As pointed out by #Alan Wells the execution time is not affected by the amount of projects in your account, however your Apps Script quota limits apply to the sum of all your projects.
And if the code were a running as an Add-On it would probably do so on different servers as the users would be running the code from their account, and likely in different geographic locations.
But to summarize:
If the code is running from your account, then it goes against your quota limits.
Apps Script isn't scalable. You can't somehow get more quota.
If your code were published as an Add-On, then the code would run as if it were on the users account, and go against their quota.
Add-On users can't see the project code even though it's using their quota.
You can view the duration of the different script executions in the Apps Script dashboard's execution tab.

Related

Google Data Studio Community Connector & Apps Scripts Limits (30 simultaneous executions)

I am in the process of building a custom Data Studio Community Connector for my web app using Google Apps Script. In my case, the data studio report is embedded as an iframe and the visibility is "public" for users of my application and I do not require any additional Google authorization (it is running as me).
Given that Apps Script has a maximum 30 simultaneous executions limit, does that mean that if I have 30 users simultaneously trying to view the report, I will hit the 30 simultaneous connections?
If that's the case, if I wanted someone else to be executing it, how would I go about doing that? Thank you.
About the number of concurrent accesses to Web Apps, in my experience, when 30 concurrent users are accessed to the Web Apps, there was the case that an error occurs. You can see the experimental data at this answer.
In my recent experiment, I have reported "Concurrent Writing to Google Spreadsheet using Form". In this case, in order to test the concurrent accesses to the Web Apps, I used the LockService in the script of Web Apps. By this, I could find that concurrent access to more than 30 users can be achieved. You can see the experimental data in the following figure.
But in this case, I think that this result will depend on the script of Web Apps. For example, when the script of Web Apps is complicated and the process cost is high, the number of concurrent accesses might become low. So please be careful about this. But, it was found that the LockService for Web Apps is important for concurrently accessing Web Apps.
In my Community Connector data source settings, I had to set it to run as Viewer (pictured below).
However, this prompts the user to authorize the community connector as well as to OAuth their Google account so the script can run as them. I submitted my OAuth consent screen for verification and it was approved within 48 hours.

Can a Google Apps Script Web App be scalable?

I'm developing a Google Apps Script Web App. This web app is the next version of FlipVideo, a script that I previously developed in a Google Sheet (see version at https://sites.google.com/view/flipvideo/)
This is a school oriented web app. A lot of students will access at the same time from around the world (thousands probably). I'm worried about scalability and quota limits.
I will publish the web app using "Execute the apps as: user accessing the web app" and "Who has access the app: anyone". Could this configuration allow thousands of concurrently executions or there is a hard quota impossible to scale?
Unfortunately, what you require is not currently possible. GAS Web Apps have a max of 30 concurrent users (see simultaneous executions under current limitations on the quotas page). You'll need to leverage a different solution to operate at such a large scale. If you want to stick with Google's Cloud Platform I would recommend using Cloud Functions. However, its not a free service.
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.
This above limitation means a single user cannot have the same script executing 30 times. For example, you can achieve this limit by opening the same web app in 30 different tabs. So I guess the limit on the number of users does not exist, or else App Script would lose all meaning as an IDE.

Support 5000 concurrent users of Apps Script Web App

I am in the process of architecting a small application for a G Suite customer. The app will be used by all employees at the customer and during peak times could see as many as 5,000 concurrent users.
They do not have App Maker and do not plan to enable App Maker anytime soon.
Will an Apps Script Web App be able to handle this many concurrent users?
Database:
I was originally thinking of using a Google Sheet as the database. There are no documented Apps Script limits around reading or writing data to a Google Sheet. So as long as I stay within the Google Sheets API quota limits I should be good.
With that said, I am also debating on using Cloud SQL as the database. App Maker forces you to use Cloud SQL so I assume it is a superior option to a Google Sheet. The only way I see to connect to Cloud SQL from Apps Script is via the JDBC service. However there is a hard limit of 50,000 connections per day. https://developers.google.com/apps-script/guides/services/quotas#current_quotas
Does anyone know if this limit is per app script or per user?
If per app script, then 5,000 users would only have 10 calls each per day. That would be unusable for my needs.
Side note, Google Cloud SQL has a maximum of 4,000 connections. I am banking on the fact that reads and writes will be extremely fast so max connections at a single point in time will be less than 4,000.
As TheMaster noted in the above comment you have a max of 30 simultaneous executions which limits you to a max of 30 concurrent users for a GAS Web App.
As an alternative you might be able to leverage Cloud Functions (basically just a Node.js/Express.js module). ̶M̶a̶x̶ ̶n̶u̶m̶b̶e̶r̶ ̶o̶f̶ ̶c̶o̶n̶c̶u̶r̶r̶e̶n̶t̶ ̶u̶s̶e̶r̶s̶ ̶i̶s̶ ̶1̶0̶0̶0̶ ̶t̶h̶o̶u̶g̶h̶. It's not a free platform, but it supports CloudSQL and may be cheaper than getting a Google for Business account (US$11.00 per month per user) as required by App Maker.

What is google sheets maximum access limit

i currently have a google web app that takes a value then checks it against 14,0000 cells in a master google sheet. i've had the idea to break the function down into 14 functions that run simultaneously(each function searching 1000) therefore cutting the runtime from 6 seconds to below 1. The issue i am concerned about is the limit of 30 simultaneous functions running. this web app will be used by more than one person at a time so it needs to be able to do more than 30. My idea is to create an account for each user with a copy of the web app for each account, so that the simultaneous executions will stay around 14 for each user. so my question is this, Does google sheets have a limit to the amount of simultaneous read/write? any help is greatly appreciated.
If you can implement this I think there are no limits.
This version of the Google Sheets API has a limit of 500 requests per
100 seconds per project, and 100 requests per 100 seconds per user.
Limits for reads and writes are tracked separately. There is no daily
usage limit.
https://developers.google.com/sheets/api/limits

Memory limit exceeded

I am using Google Apps Script to create documents based on a template and some data stored in a spreadsheet. It was previously working well but recently (without having changed any code) I started getting the below error during a "google.script.run" call from a very simple HTML sidebar:
Execution failed: Memory limit exceeded
The error occurs during the copying process - it seems to occur at slightly different places each time the script is run.
I don't see any references to memory limits in the apps script quotas and a general Google search doesn't seem to find anything.
Can anyone shed some light on this and how to determine the limit/what is holding most of the memory/increase the limit if possible?
Check the methods that you're using to get the data ranges.
i.e. if you use sheet.getRange(A:X) it'll get all the rows in the sheet, even the empty ones (probably in the order of tens of thousands, or even hundreds of thousands). It's a better option to use the getDataRange method, which get the last column and last row with data.
Be noted with the Quotas for Google Services. Apps Script services impose daily quotas and hard limitations on some features. If you exceed a quota or limitation, your script will throw an exception and terminate execution.