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.

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.