A question about my project using sanic


Hi everyone,

I am Jason. I am working on a python web server that people could call our machine learning program to calculate something. I am new to python and sanic, so I am not sure how to solve my problem.
Since the machine learning program uses the CPU heavily, so I thought the server structure could be like this.

I don’t know how to code the machine learning worker that runs infinitely along with the server.
Hope you guys could give me some ideas. Thanks


You probably want to look in to pub/sub architecture, where the post route pushes to a queue, a worker of some sort picks it up, does the processing, and then puts the result in a database for retrieval.