skip to Main Content

I have seen a lot of different things about redis, rabbitmq, kafka etc. but even with that I don’t really understand what would be the best use in my case.

I have a flask app that will be deployed. In this app, each user will send their own requests, potentially at the same time. From this request, I’ll have to run different python functions taking 1 to 10 minutes, and once it is done, update the database to give the user his content.

What is the best system to do that, knowing that the created content will not be too big (an element is up to 10000 string characters, and each user creates max ~200 elements/month) ?

Thanks in advance I hope that I was clear enough !

2

Answers


  1. Firstly, You will need to implement an load balancing system on your server, Also It must have to multiprocessing/multithreading features. You must select ngnix web server for this project.

    Login or Signup to reply.
  2. I would suggest using FastAPI instead of Flask however… the syntax is pretty similar so it’s not a big leap…

    FastAPI is built from the ground up with asynchronous programming in mind. It is based on the asyncio library and makes use of Python’s async and await keywords, which makes it easier to write efficient and scalable code for handling requests and responses.

    Flask, on the other hand, is not designed for asynchronous programming, and while it does support some level of async programming, it requires more work to set up and use compared to FastAPI. Flask’s reliance on traditional synchronous programming can lead to performance issues when handling large numbers of concurrent requests, while FastAPI’s asynchronous architecture enables it to handle high traffic with ease.

    FastAPI also provides built-in support for modern features like type annotations, automatic documentation generation, and data/request validation, which make it easier to write reliable and maintainable code.

    Theres a good cookie-cutter example from the creator of FastAPI here. It may look daunting but you can remove all the frontend and unnecessary stuff and have a really nice starting point!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search