Reading Library's cache

17 views
Skip to first unread message

TDS Reader

unread,
Sep 16, 2025, 1:27:11 PMSep 16
to Google Apps Script Community
I am building a tool that may potentially be used by many people (say a million). I am sharing data via a Google Apps Script library's CACHE and the users are regularly (for example every few seconds) reading that cache via cache.get(). Is there any limit on how often people can be reading the shared library's cache?

Keith Andersen

unread,
Sep 16, 2025, 3:13:14 PMSep 16
to google-apps-sc...@googlegroups.com
Per Gemini (Google AI)

Yes, there are limits, but not in the way you might think. Google Apps Script doesn't have a specific quota on the number of cache.get() calls. Instead, the limitations are on concurrent executions, and how your script uses resources.
The main concern with a million users reading from a shared library's cache is not the get() calls themselves, but the potential for simultaneous executions and total execution time, which are subject to quotas.
Key Limitations 🎯
 * Concurrent Executions: There's a limit on how many script executions can run at the same time for a single user account (the one that owns the script or library). For consumer accounts, this is usually around 30, and for Google Workspace accounts, it's also around 30. If your million users are all executing the script at once, many of them will be queued or fail with a "Service invoked too many times" error.
 * Total Execution Time: While a single execution is limited to 6 minutes, there are also daily limits on the total cumulative execution time for a user account, especially for scripts running from triggers. A high volume of frequent, short executions will quickly exhaust this quota.
 * Cache Service Itself: The CacheService is a shared resource. While there's no public limit on get() calls, the underlying infrastructure can experience throttling if it's hit with an extremely high volume of requests. It's designed for a high read-to-write ratio and is most effective for frequently accessed, but infrequently updated, data.
The Problem with this Architecture 😬
Using a single shared library cache for a million users is not a sustainable or scalable architecture for a few key reasons:
 * Quota Bottleneck: All users are hitting the quotas of a single owner account. The entire system will grind to a halt as soon as you hit the concurrent execution or daily execution time limits.
 * Performance Degradation: As your tool scales, a single cache will become a bottleneck. The more requests you have, the more likely you are to experience latency and errors.
 * No Guarantee of Data Persistence: Cached data is not guaranteed to persist. Google's cache service may evict data at any time, especially under heavy load.
A Better Approach for Scalability ✅
For a large-scale tool, you should not rely on a single Google Apps Script cache. Instead, you should consider a more robust and scalable solution:
 * Google Cloud: Use a dedicated service like Cloud Firestore or Cloud Storage. These services are designed for large-scale, high-traffic applications.
 * User-Specific Caching: Use the userCache to store data unique to each user. This distributes the load and prevents one user from affecting another's experience.
 * External Databases: For data that needs to be shared, use a dedicated database service (like Google Cloud SQL) that is built to handle many concurrent connections and high throughput.




My website: https://sites.google.com/view/klaweb/
Passions: God, Family, Scriptures, Learning, Data Management, Google Sheets + App Script and much more!

On Tue, Sep 16, 2025, 12:27 PM TDS Reader <tdsrea...@gmail.com> wrote:
I am building a tool that may potentially be used by many people (say a million). I am sharing data via a Google Apps Script library's CACHE and the users are regularly (for example every few seconds) reading that cache via cache.get(). Is there any limit on how often people can be reading the shared library's cache?

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/7425ef74-38ec-4aee-8eb1-24486f704aa9n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages