PHP-Python Workflow - On Demand

Dan 1 Reputation point
2021-02-20T16:52:45.007+00:00

Hi everyone,

I'm looking for some solution design and ideas for a little side project site I'm working on. In brief, the way it works is, PHP will generate a .php file and that file contains instructions to run a python job. The python job should execute, gather the required data, and then return the results to PHP. Next, PHP will run a secondary task, which again requires the execution of a different python job once the data is provided to PHP, PHP will in turn display data to the front end/website, and the workflow is finished.

Now, I got some of this process working on a VM, but the proxy scripts takes 1-2 mins to run on my server, and I need to bring it down to 5 seconds or less. The way for me to bring it down is by having python re-configured to run it's processes via threading 50x. I can't do this locally on the VM server as it doesn't have the resources to run 50 threads simultaneously, so I' thinking about offloading this to a fast and cost efficient solution, ie Azure. If I can have PHP send the request to Azure for processing of the python job, then that may solve my problem and it really shouldn't cost much, especially if I'm billed according to time utilizing the platform (few seconds for each request).

I'm looking for some opinions and ideas, as I'm just trying to learn more about Azure. Can I use containers, logic apps, or functions, etc. If anyone has any suggestions, I can dig deeper on those features and topic.

Additional Note: The python job is not just a single .py file, it's a library which consists of python files, jsons, cfg, etc. Here is an example of what the files look like in one of the python jobs: https://github.com/mirhmousavi/Pois

Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,504 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,945 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,184 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 69,926 Reputation points
    2021-02-23T11:17:48.733+00:00

    Hi @Dan

    Welcome to Microsoft Q&A! Thanks for posting the question.

    I will suggest you to review the compute decision tree to know what would be the best azure service you can use to migrate your existing application.
    If your application is already containerized then the best would be running it on the container instance. Azure function would be the best fit if you can rework your application to make it work with azure functions and at the same time it will be cost effective but for high intensive works continuously you can choose different web apps plans.

    0 comments No comments