Home > OS >  Temporarily Scale Up Azure Web App RAM (e.g. App Service Plan) for Single Requests
Temporarily Scale Up Azure Web App RAM (e.g. App Service Plan) for Single Requests

Time:05-08

We have an Azure web app used for internal reporting, and 99% of the time it can handle all the traffic / requests it needs to on the minimum pricing tier (3.5 GB RAM).

But there is one specific request to generate an Excel Report that temporarily requires ~8 GB of RAM to service (ClosedXML is a beast, and we've already minimized the peak RAM footprint in every way possible). Unfortunately, this requires not only the next pricing tier up (7GB) but the one after that, giving us 14 GB to play with.

This request only takes ~1 minute to service, so after trying everything else, I'm considering using Azure APIs to programmatically change the App Service Plan when the request comes in, wait the 10 seconds or so for it to kick in, then process the request, and scale back down afterwards.

Is this a sane approach, or is there some other feature I'm not aware of to temporarily perform a memory-hungry action? I considered an Azure function, but those are limited to 1.5GB RAM. As far as I can tell, this work can't be subdivided up in any way without becoming an expert on manipulating the zipped-XML underlying Excel workbooks.

CodePudding user response:

Sounds reasonable what you are trying to do, we are doing similar things where we scale thing up before running massive monthly imports, we scale both the front end functions and the back end CosmosDB and then scale back down again once the import is done so I don't think you will have any issues doing this.

On a side note there is no 1.5 GB limit on azure functions, it totally depends on the underlying hosting solution, you can host a function on a P3V3 App Service Plan or even bigger dedicated plans and benefit from the resources they provide but that is a different topic.

CodePudding user response:

No out of box from AppService (Plan). In similar situation, we started with an automation account but upgraded to LogicApps.

Using LogicApp as request broker, for specific kind of operation invoke https://docs.microsoft.com/en-us/rest/api/appservice/app-service-plans/update to scaleup the AppService plan and after the successful completion scale down. Btw, hosting the LogicApp on the APIM as well before exposing the url!

  • Related