Share via

Check usage per function app when multiple function apps are using a single App Service Plan

Krishna Chaitanya Palakodety 0 Reputation points
2023-07-03T05:23:28.7833333+00:00

Lets say I create three different function apps on a single app service plan, is it possible to get usage per function app? I am building a multi tenant system and I am planning to create one function app per tenant but all of these share the same app service plan. I would like to bill the customers based on their usage. So, is it possible to get the usage metrics or bill broken down at the function app level even if they all share the same app service plan underneath?

What is the suggested way for deploying multi tenant applications? I can create one app service plan per function app/tenant, but as the number of tenants grow, it would be too many plans and if I need pre-warmed instances, it would turn out too expensive. Most tenants are idle and it makes sense to share computing resources across tenants in my case.

Can you please share relevant documentation along with the answer?

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Azure
Azure

A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.


1 answer

Sort by: Most helpful
  1. Anonymous
    2023-07-03T11:10:37.0033333+00:00

    Hi Thanks for the question

    I assume you have good reason to use Functions on a plan (I assume "elastic premium") as opposed to using consumption? The pricing on consumption being more attractive for functions that are called infrequently.

    You can use App Insights to track request telemetry , that would be per function execution (see here). App Insights supports a number of language runtimes. The metrics available from the platform would only show you information split by instance (worker VM).

    One consideration with this approach - as you'll potentially be putting quite a few functions onto the plan (and the plan will scale-out with all those funcs/slots per instance) you are at risk of a particularly busy function taking more resources and potentially impacting other functions (the "noisy neighbour" problem).

    In that case you would need to pull the busy, or resource intensive function onto it's own plan. The point being you should monitor not just for billing purposes but to ensure that you dont get this sort of issue and you may need more than one plan , with different vertical scale/size - so categorize functions based on expected usage and host accordingly to prevent contention. (Again, App Insights is your friend).

    Note: The "diagnose and solve problems" functionality, available in the portal through the menu item of the same name (from the plan resource) provides some useful insight and also a hint on recommended realistic number of func apps per plan.

    ---

    Another approach here worth considering (although this brings added complexity/cost) is using Az API Management between client and API/Functions.

    Azure API Management comes in both consumption , multi-tenant and fixed , single tenant tiers. See pricing here.

    This would allow you more out of the box insight (through the built in analytics) which is often useful in the scenario you describe. See here for more info.
    In addition APIM allows you to set up quotas and rate limiting by key.
    APIM also integrates well with App Insights and offers other options

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.