Question

Help understanding functions limits and how to make sure I stay within these limits

Hi!

I am working on a personal project that will use serverless functions extensively, which is a backend part I am still learning. I will use only async functions through the rest api.

One thing I noticed was the limits listed in the documentation.

So, I have a couple of questions:

  1. About the Up to 120 concurrent functions, does this mean 120 different functions being called at the time, or 120 invocations of any function running at the same time?
  2. I will only use a single async function, does this mean I can have at max 120 invocations of it running in parallel?
  3. If I do reach the limit, will there be an error response to easily know when I have to wait, or should I keep a count myself?
  4. Also, there seems to be a limit of 600 invocations per minute. Are there common patterns/services I can use to handle this situation?

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
November 21, 2023
Accepted Answer

Hey @rafaeltragueta79,

Absolutely, let’s break it down:

  1. Regarding the 120 concurrent functions, it’s about how many function invocations you can have running simultaneously, not the number of different functions. So yes, you can have 120 instances of your single async function executing at the same time.

  2. When you reach this concurrency limit, DigitalOcean Functions will handle it gracefully. You’ll receive an error response for any invocation that exceeds this limit. This way, you can set up a retry mechanism in your code to handle such situations without keeping a count yourself.

  3. As for the 600 invocations per minute limit, a managed service like DigitalOcean’s Managed Kafka is a great fit. You can produce events to a Kafka topic whenever you need to invoke a function. Then, your function can consume these events at a controlled pace that keeps you within the permissible rate. It’s a robust way to decouple your workload and manage spikes in demand.

https://www.digitalocean.com/products/managed-databases-kafka

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel