0

I'm going to build rest Api layer using dot net 6. but I have two options available

  1. create rest Api layer as azure functions (http triggers)
  2. create web Api using dot net 6.

We are expecting high volume of request to these Api. What would be the best and cost optimize approach to implement this Api layer?

  • 1
    Please see this thread - https://stackoverflow.com/questions/70683888/how-to-optimize-application-insight-costs-for-azure-functions/70690850#70690850 - helps you to optimize the Application Insights Cost from the high volume of requests, responses, and Exceptions Data! –  Apr 18 '22 at 02:39
  • Though Azure function and Web API both belongs to `Azure web App service` therefore, In short definitely [`Azure function`](https://stackoverflow.com/questions/56497251/azure-function-as-a-web-api-performance-and-pricing) you don’t need to manage whole web app service itself rather just need you have azure function and you can scale out as per your consumption plan. However, it’s not clear what about your business requirements are, depending on that if you require full flexibility and custom application environment in that case you would think of `Web API` – Md Farid Uddin Kiron Apr 18 '22 at 02:44
  • Feel free to share if you have any further queries on both. In addition for [`web API and costing you could check here`](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans#how-much-does-my-app-service-plan-cost). which couldn't be shared above comment due to comment limit. – Md Farid Uddin Kiron Apr 18 '22 at 02:47

1 Answers1

0

AFAIK, there will be more logs generated in Azure Functions Http Trigger APIs and Web APIs during its runs and executions.

There are few costs Optimization approaches that can be done in Azure Functions host.json file level.

Based on different values of Host.Results in host.json file of the Azure Functions Project, it will generate different level of logs like Information logs, failed function executions, dependencies logs, customMetris, customEvents, traces, etc.

Also, there are few other techniques helps you to control your Monitoring Cost of the Function Apps like Sampling, daily cap setting, Pre-aggregate metrics, customizing the logs collection.

I have given a workaround of Azure Functions Python application to minimize the logs required for tracing the errors. Please check the below references:

  1. How to optimize Costs of Applicaiton Insights in Azure Functions
  2. Cost Optimization Techniques in Azure Functions

As per Md Farid Uddin Kiron suggestion, that cost management also depends upon the Hosting Plan you choose for the Azure Functions in which Consumption Plan gives you optimized cost and high performance whenever the high load comes, you can scale out the instances running your application to give better performance.

Coming to the Web API - First, it depends on the Hosting Plan you choose like Basic, Free, Shared, Premium and Standard.

Because it doesn't charge on the features of the App Service Plan, it charges based on the usage of that features and the instances in that selected App Service plan are charged regardless of how many apps you kept in the ASP.

To know more information regarding optimizing the cost of App Services like Web API, refer this App Service plans - Azure App Service | Microsoft Docs.