1

Currently, I have PuppeteerSharp running on a .NET Core Azure Function on Linux Consumption Plan. My local runs in 6-11 seconds. The azure function one runs in 25 - 40 seconds (this is after cold start). I'd like to bring back that time as much as possible - hopefully while staying within the realm of Azure or Cloudflare. I am not against moving to node (not using PuppeteerSharp, just straight puppeteer) if necessary.

I've heard that running in Azure Container instances might provide better results. But one of my requirements is that the serverless API scales up/down with load (and obviously the price fluctuates with the load). I am not building a screenshotting service - it is essentially running a hefty browser app, running some processes, and saving some output from it.

Avisra
  • 740
  • 5
  • 14
  • You can consider creating your Azure Function app in Premium Plan As per this MS Document- https://learn.microsoft.com/en-us/azure/azure-functions/functions-premium-plan?tabs=portal If you create your Function app with Premium plan it eliminates your Cold start – SiddheshDesai May 03 '23 at 13:17

2 Answers2

0

According to this MS Document, In order to eliminate Cold start and improve your Azure functions performance you can create your Function app in Azure Functions Premium plan as Premium plan has always ready instances and Pre-warmed instances which reduces latency and improves performance of your Functions.

enter image description here

And deploy your puppeteerSharp function in the Function app above.

enter image description here

An alternative is to use Azure Container Instances but it will incur more charges than your Function app.

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11
0

We are hosting an ASP.NET Core API which contains an endpoint that generates a PDF using Puppeteer-Sharp. We are using Azure Container Apps for hosting that endpoint. The performance is okay.

Some statistics from an average day:

  • Requests: 510
  • Response times: 877ms
  • Min. / max. scale: 0-1
  • Costs: € 2.53,-
  • CPU cores / memory: 2 / 4Gi (We did not yet run tests to lower the CPU and/or memory.)

I've written a blog article on how to setup.

Maikel
  • 71
  • 7