Concurrency refers to the number of a function executing at the same time.

Unless otherwise specified, all functions within the same account share an overall concurrency limit that you can raise upon request. When a function reaches its maximum concurrency limit, synchronous invocation requests result in a throttling error, and asynchronous requests queue up in the backlog.

Functions run with unreserved concurrency by default, meaning they scale up automatically while the account has sufficient capacity. You can configure functions to run with reserved concurrency to avoid overloading downstream services and ensure those functions can always scale up to the required level of executions.

Determining concurrency level

The level of concurrency for a function is determined by the average request arrival rate and the average execution time to process a single request.

Concurrency = (Average requests per second) X (Average execution time per invocation)

You can also use this formula to estimate the average maximum throughput. For example, you could use it to estimate a large backlog of asynchronous requests.

Average throughput requests per second = Concurrency / (Average execution time per invocation)

Reserved concurrency

When you set up a function to use reserved concurrency, Stedi subtracts this reserve from the overall account limit, and it becomes unavailable to other functions. This applies even when the reserved capacity is not in active use.

You may want to configure a function with reserved concurrency for the following reasons:

  • Ensure that you always have available capacity to scale up to the reserved level, even if other functions executing in the same account are experiencing a high load.
  • Limit the maximum parallel executions to protect a downstream system from overload.
  • Protect your functions from scaling up to very high levels in case of unexpected overload, such as from upstream systems or accidental event loops.

Set max concurrent executions

To set up a function to use reserved concurrency:

  1. Go to the Functions UI and click the function you want to edit.
  2. Set the Max concurrent executions under Settings.
  3. Click Save.