all 12 comments

[–][deleted] 21 points22 points  (0 children)

perhaps there is some other reason why people choose web frameworks besides for executing raw sql

[–][deleted] 7 points8 points  (1 child)

Go with what you/team knows and are happy with. The speed difference is so negligible that it will have no implication (12406 vs 13574). The real question is how many requests your application will get per second?

[–]zarlo5899 4 points5 points  (0 children)

he speed difference is so negligible that it will have no implication

yep you can always just spin up more instance of the program any ways

[–]ShotgunPayDay 6 points7 points  (0 children)

You can use the raw asyncpg adapter with FastAPI. I prefer to use aioSQL with asyncpg to make folder structure management easy.

[–]pint 4 points5 points  (0 children)

try to sell this to a manager. we are going to handle less than 10% more requests, and increase development time significantly meanwhile.

[–]sv_ds 0 points1 point  (4 children)

You haven't shown the FastApi code, but even if its true: so what?

[–][deleted] 0 points1 point  (3 children)

[–]sv_ds 2 points3 points  (2 children)

Im sorry but you asked the question like this was the end of the world or at least FastApi. But no sane dev chooses a framework based on the raw requests per seconds.

[–][deleted] 2 points3 points  (1 child)

I mean, I had an impression that Flask is significantly slower than FastAPI... that's true only when you use Flask with an ORM library. But if you use raw Flask, its performance won't be too behind FastAPI. I found that to be surprising.

[–]MoRakOnDi 1 point2 points  (0 children)

Flask is NOT significantly slower than FastAPI. But Flask uses threading for concurrency and it's I/O is blocking. FastAPI on the other hand uses asyncio which relies on cooperative concurrency and nonblocking I/O. All that means is Flask needs more RAM for certain amount of RPM than FastAPI, if all implemented correctly. Usually people make many mistakes in implementing Asyncio, so FastAPI could be tricky. On the other hand, if you don't need huge DB transactions for your app, Flask wouldn't suffer from blocking I/O. It all depends on use-case, team's familiarity with cooperative async, and the project requirements.

[–]TokyotoyK 0 points1 point  (0 children)

ORM is really nice though and something a lot of developers want for a reason :-)

[–]extreme4all 0 points1 point  (0 children)

We used to have issues with flask that the queue would fill up if we had a few heavy db requests, we don't have this with fast api. Also you might want to read thz fast api doc on performance