Async in practice: how to achieve concurrency in FastAPI (and what to avoid doing!)

  Рет қаралды 21,130

Evgeny Maksimov

Evgeny Maksimov

Күн бұрын

Пікірлер: 41
@hamzadlm6625
@hamzadlm6625 Жыл бұрын
« writing async in front of every function and hoping for the best » yup that’s me 😂
@dasshrs
@dasshrs Жыл бұрын
That is really how it looks like when you do not check the implementation under the hood That was me too btw:)
@swx6074
@swx6074 Ай бұрын
Your tutorials are one of the best out there, perfect amount of theory and examples. You should totally upload more:)
@serhiiserhieiev2583
@serhiiserhieiev2583 11 ай бұрын
Лучшее видео по FastAPI что я смотрел за последнее время. Кратко и в то же время очень ёмко. Видно что автор глубоко разбирается в вопросе. Респект!
@evgenymaksimov
@evgenymaksimov 11 ай бұрын
спасибо :)
@rns10
@rns10 3 ай бұрын
This video is really a good reference when converting a sync project to async selectively. I will have to this video 2-3- times to understand whats going on in each scenario. I recently saw a conference video as well where they highlighted how making app async can block CPU bound processes, but there were not many examples. This video covers that extensively. Thank you
@dasshrs
@dasshrs Жыл бұрын
You desire a million views - that is a great in-depth tutorial!
@corner4730
@corner4730 2 ай бұрын
This is awesome content dude, I am subscribing right away
@zemalex89
@zemalex89 8 ай бұрын
finally amazing explanation with good examples I don't know how how come that you don't have a milion of views
@avitiwari7921
@avitiwari7921 2 жыл бұрын
Excellent tutorial👌 and very accurate, precise chart. These are some much needed topics to be taken care of. My small request will be to share the code and chart in a repo, it will be much helpfull.
@evgenymaksimov
@evgenymaksimov 2 жыл бұрын
Thank you for the kind words! Noted, I added git with chart to the video description :)
@КириллКулаков-т7г
@КириллКулаков-т7г 2 жыл бұрын
hi, Evgeny! great job! crystal clear explanation! big thanks!
Жыл бұрын
@evgenymaksimov 26:09 Of course, we cannot see that it has made a big difference with just a request. If you send thousands of IO-heavy requests, each request will be dedicated to a different thread, and as you said before, the application will lose performance after a while because the threads are memory hungry. If we use coroutines instead, I can say that they are lighter threads, the application will run more efficiently. Actually this may also be an answer to when to use thread and when to use async.
@evgenymaksimov
@evgenymaksimov Жыл бұрын
great point! thanks
@beme-l2k
@beme-l2k 4 күн бұрын
great vid! Just one thing, I think your "run_in_process" function is actually creating a thread and not a process, no?
@chapizishorts6528
@chapizishorts6528 11 ай бұрын
14:50 What about GIL, doesn't it forbid to create multiple threads within 1 process?
@evgenymaksimov
@evgenymaksimov 11 ай бұрын
It doesn't forbid to create, it just doesn't let more than one kernel thread take execution at the same time. However, for I/O calls GIL is getting realeased, so it doesn't impact it in our case
@huyubosaka8906
@huyubosaka8906 2 жыл бұрын
Thx for best material. It will be interesting if you do video about ASGI and WSGI web servers.
@evgenymaksimov
@evgenymaksimov 2 жыл бұрын
Thank you! I’m considering it
@payitapp
@payitapp Жыл бұрын
Is it just me or our good tutor looks like Scarlett Johansson's brother 🤔. This is A really good tutorial by the way. Gives good context for how to write Async code.
@jafeta.7553
@jafeta.7553 5 ай бұрын
Great video. Thank you very much!
@ahmadreza2189
@ahmadreza2189 8 ай бұрын
Great video, well done!
@rondechaka1160
@rondechaka1160 11 ай бұрын
This video should have more views 👍
@akshaysarbhukan6701
@akshaysarbhukan6701 2 жыл бұрын
Thanks for the tutorial. I have a question, is there any way to implement server sent events in FastAPI?
@evgenymaksimov
@evgenymaksimov 2 жыл бұрын
take a look at pip package sse-starlette, it adds this functionality and you can use it with fastapi!
@akshaysarbhukan6701
@akshaysarbhukan6701 2 жыл бұрын
@@evgenymaksimov thanks. So basically FastAPI still uses http 1.1 on top of which sse-starlette implements SSE, am I correct?
@evgenymaksimov
@evgenymaksimov 2 жыл бұрын
@@akshaysarbhukan6701 not quite. FastAPI itself doesn't have hard dependecy on webserver. Regularly most use uvicorn as webserver, which uses http 1.1, but you can install hypercorn instead which supports 2.0 and it will work just fine
@akshaysarbhukan6701
@akshaysarbhukan6701 2 жыл бұрын
@@evgenymaksimov yeah, got it. Thanks again for the help.
@jimmykhaidem9291
@jimmykhaidem9291 11 ай бұрын
Hi bro, can you make a video of using chunk method
@alekseichulei9955
@alekseichulei9955 Жыл бұрын
Did you try to use psycopg3 since it provides async?
@SabyrBerikuly
@SabyrBerikuly 5 ай бұрын
can you send a book you are referring to in your video?
@neerajbansal2613
@neerajbansal2613 3 ай бұрын
thanks, good info
@luisgarciacuesta6120
@luisgarciacuesta6120 Жыл бұрын
Great video, thanks!
@radoniainarakotonirina2856
@radoniainarakotonirina2856 Жыл бұрын
Very interesting
@Урал-и1б
@Урал-и1б 6 ай бұрын
Отличное видео
@Optimusjf
@Optimusjf 5 ай бұрын
Excelent
@Smarandii
@Smarandii 10 ай бұрын
Good job comrade
@tomasemilio
@tomasemilio 9 ай бұрын
Awesome
@unicoxr5tj417
@unicoxr5tj417 2 жыл бұрын
подписался) Жека а че не на русском?)
@CodingByAmp
@CodingByAmp Ай бұрын
i support follow
@PassengerNY
@PassengerNY 9 күн бұрын
Есть на русском?
Next-Level Concurrent Programming In Python With Asyncio
19:19
ArjanCodes
Рет қаралды 184 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
FastAPI Internals - How does it work? - Marcelo Trylesinski
31:08
Python Italia
Рет қаралды 3,6 М.
Python Asyncio, Requests, Aiohttp | Make faster API Calls
17:56
Patrick Collins
Рет қаралды 138 М.
Intro to async Python | Writing a Web Crawler
14:23
mCoding
Рет қаралды 82 М.
Performance tips by the FastAPI Expert - Marcelo Trylesinski
24:59
EuroPython Conference
Рет қаралды 9 М.
Concurrency Concepts in Python
51:57
MathByte Academy
Рет қаралды 10 М.
Building a REST API with FastAPI, Async SQLAlchemy, and PostgreSQL
1:23:24
AsyncIO & Asynchronous Programming in Python
12:28
NeuralNine
Рет қаралды 157 М.
AsyncIO, await, and async - Concurrency in Python
9:12
Socratica
Рет қаралды 116 М.
Why You NEED To Learn FastAPI | Hands On Project
21:15
Travis Media
Рет қаралды 172 М.
Raw SQL, SQL Query Builder, or ORM?
16:19
ArjanCodes
Рет қаралды 106 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН