1

In azure function app, how does the runtime or host manages multiple requests? Like in regular web api project or app service one instance can handle multiple request. Is that true that in azure function app, same function host or instance cannot be reused until the previous request get completed? If so, how it is going to behave for those requests which takes quite long to respond? Is it going to spawn multiple instances?

e.g. if there’s a route /api/processvideo which takes 20seconds to process the request and if we receive 30 request at the same time, does azure scale controller spawns 30 instances to process all those request?

Manish Rawat
  • 1,142
  • 1
  • 18
  • 34
  • An endpoint can handle multiple requests at once. So if your endpoint takes 30 seconds to finish, then while it's processing that request another request comes in, it can/will use the same instance. Think of it like a method in your code. You can have multiple threads call the same method at the same time. More info: https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#scale The beauty of Serverless Services is you shouldn't have to worry about it. But, it comes at a cost if you aren't careful. – Andy Feb 24 '21 at 03:10
  • Also, i notice your endpoint says "processVideo", if you are looking for a super cheap way to convert videos, consider Azure Media Services for Encoding: https://azure.microsoft.com/en-us/services/media-services/encoding/ – Andy Feb 24 '21 at 03:14
  • What’s the cost which you are referring? And at what time it is going to scale up the instance? – Manish Rawat Feb 24 '21 at 03:18
  • It's on that same page: https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#billing – Andy Feb 24 '21 at 03:33

0 Answers0