Use Case
I have written a programme which will open puppeteer in nodejs
and perform some jobs. The job can take 30-50 minutes in order to finish. Normally in a day, there will be 400-500 jobs, but some random situation can require 10K+ jobs to be executed in a day. We don’t know about the random situation, as it depends on the users. Also, this random situation will occur very rarely, once/twice a month.
Every job needs to be finished under a specified time limit as the part of our SLA.
We can’t keep the servers running to handle 5k load, as it’ll occur very rarely.
So, I thought of going with azure functions or web jobs. But not sure which one should i pick.
Any help would be appreciated and thanks in advance.
2
Answers
I realize that I’m not answering directly your question but anyways…
Assuming that the job is triggered by an HTTP call and that it can only be triggered once until it completes and that you don’t want to over provision resources, I would look at something you launch and destroy on demand, basically decoupling the trigger from the job.
Here’s an option: Containerize your app. Create a Logic App or Function that is triggered by an HTTP call and will create an Azure Container Instance to run an instance of your job.
While Logic App can wait for the job to complete, this will incur additional unwanted costs. Have your job write a message to a queue that will trigger a Logic App or a Function to destroy the Container Instance.
Another option might be to look at Durable Functions.
Honestly, for that job durations you would be better of with running those jobs on server.
If that is not an option, think about breaking that logic into smaller pieces which all take under 1 minute to execute, and then orchestrate it through Azure Durable functions.