Enforced limits

Several limits are in place to prevent Functions from consuming too many resources when they are executed.

Time limit

Each Function execution is limited to 30 seconds of CPU time, but if loading data over the network, can run for up to 60 seconds. When a Function times out by exceeding the 60-second threshold, the culprit is often inefficient data loading logic. Refer to the section on optimizing performance for tips on how to avoid timeouts.

Memory limit

Each Function execution is limited to 128 Megabytes of memory usage. This limit is rarely reached; most often, Functions run into time limits or object loading limits before memory limits.

Single thread

A single function executes on a single thread so only one computation is allowed at any given time. However, you can parallelize loading of object sets or links. Refer to optimizing performance.

Object Set load limits

When using Object Sets, calling .all() or .allAsync() will throw an error if:

  • More than 100,000 objects are loaded at once from the Object Set. In general, even loading tens of thousands of objects will run into time limits or memory limits. For use cases where you are running into this limit, consider fetching summary data using aggregations or fetching a subset of objects using ordering and limiting.
  • More than 3 Search Arounds are used at once.

Object Set limits

Some aggregation and bucketing operations have limits. See the aggregations section for details.