0

I'm a bit lost in the jungle of documentation, offers, and services. I'm wondering how the infrastructure should look like, and it would be very helpful to get a nudge in the right direction.

We have a python script with pytorch that runs a prediction. The script has to be triggered from a http request. Preferably, the samples to do a prediction on also has to come from the same requester. It has to return the prediction as fast as possible.

What is the best / easiest / fastest way of doing this?

We have the script laying in a Container Registry for now. Can we use it? Azure Kubernetes Service? Azure Container Instances (is this fast enough)?

And about the trigger, should we use Azure function, or logic app?

Thank you!

1 Answer 1

1

Azure Functions V2 has just launched a private preview for writing Functions using Python. You can find some instructions for how to play around with it here. This would probably be one of the most simple ways to execute this script with an HTTP request. Note that since it is in private preview, I would hesitate to recommend using it in a production scenario.

Another caveat to note with Azure Functions is that there will be a cold start whenever we create a new instance of your function application. This should be in the order of magnitude of ~2-4 seconds, and should only happen on the first request after the application has not seen much traffic for a while, or if a new instance has been created to scale up your application to receive more traffic. You can avoid this cold start by making your function on a dedicated App Service Plan, but at that point you are losing a lot of the benefits of Azure Functions.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. Where can I find more info about the benefits we lose by using an App Service Plan?
With an app service plan, you are paying for the VM your code is hosted on, as opposed to the consumption plan, where you are only paying for your executions + execution time. You also lose the ability to scale as fluidly. App Service plans have a feature called auto scale (see learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/…), but that generally isn't as easy to set up or quick to scale as Azure Functions on a consumption plan.
Thank you for your help, marking it as an answer. However, the tutorial has a link to a consumption plan, early preview, I can still make a Linux app service plan for my Azure Python Function App?
You should definitely be able to do. You might have an easier time if you do a Linux App Service Plan though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.