skip to Main Content

I am designing a multi tenant system where I get requests from multiple customers and I need to run their code in isolation on their data, which is in one of our systems. I chose azure functions as they are best for isolation and it is easier to figure out the cost per run so I can charge the same to the customers based on their usage.

However, I see from the azure documentation that max instances I can run per Function App is 200 for consumption plan and 100 for Premium Plan.

Also, the max number of Function Apps is 100. Does it mean the max functions I can run across Function Apps in a single subscription is 200 * 100 = 20,000?

Why is there a limit to this? Why cant I just run as many functions as I want and let Azure bill me for my usage?

2

Answers


  1. Chosen as BEST ANSWER

    My understanding earlier was wrong, I read some more documentation on Azure and realised what it means by an instance. Think of instance as a virtual machine.

    Now on the limits, 200 instances per function app, 100 function apps per plan, 100 plans per region in consumption plan. This turns out to be 200*100*100 VMs = 20,00,000 thats a lot of machines. Each machine with max ACU of 100.

    Now, what I can do is, create a function app per customer and put all their functions in that function app. It can scale to 200 instances, which is a lot of VMs and that should be good enough to handle a single customer's load (for our use case). Also its easy to bill the customer, by tagging that function app to that customer.

    As Peter Bons mentioned in a comment, a single instance can handle multiple requests, based on what the function code is doing and then scale out if the resources on that instance are not enough.

    Answering my own question, 20,00,000 are a lot of VMs and it makes sense for Azure to enforce that limit per subscription for fair usage. When I asked this question, I underestimated an "instance", thought its just one thread running the function code. An instance is a VM and its not a single run of Azure Function. An instance can run multiple functions at once, it all depends on how much resources on that VM the function code consumes while it runs.


  2. 200 instances means that is the maximum number of servers your function app can scale to.

    As per the service limits, you can create a maximum of 100 consumption function app service plans per region. What this means that each function app can scale up to 200 servers. So in total, per region you can get 100X200 = 20000 servers. Each of these servers can technically process multiple requests. If you want more, create another function app in a different or paired region within the same subscription.

    Am curious to understand how this addresses your requirement. You cannot assign each server to each customer. I feel this only makes sense if all customers are either sharing the the same function app or you have a load balancer in front of multiple function apps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search