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

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024

Комментарии • 34

  • @hamzadlm6625
    @hamzadlm6625 8 месяцев назад +29

    « writing async in front of every function and hoping for the best » yup that’s me 😂

    • @dasshrs
      @dasshrs 8 месяцев назад +1

      That is really how it looks like when you do not check the implementation under the hood
      That was me too btw:)

  • @serhiiserhieiev2583
    @serhiiserhieiev2583 7 месяцев назад +1

    Лучшее видео по FastAPI что я смотрел за последнее время. Кратко и в то же время очень ёмко. Видно что автор глубоко разбирается в вопросе. Респект!

  • @zemalex89
    @zemalex89 4 месяца назад

    finally amazing explanation with good examples
    I don't know how how come that you don't have a milion of views

  • @dasshrs
    @dasshrs 8 месяцев назад +1

    You desire a million views - that is a great in-depth tutorial!

  • @avitiwari7921
    @avitiwari7921 Год назад +3

    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 :)

  • @user-db3hr3xt4x
    @user-db3hr3xt4x Год назад +1

    hi, Evgeny!
    great job! crystal clear explanation!
    big thanks!

  • @payitapp
    @payitapp 11 месяцев назад

    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.

  • @ahmadreza2189
    @ahmadreza2189 3 месяца назад +1

    Great video, well done!

  • @huyubosaka8906
    @huyubosaka8906 Год назад +1

    Thx for best material. It will be interesting if you do video about ASGI and WSGI web servers.

  •  Год назад +3

    @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.

  • @rondechaka1160
    @rondechaka1160 7 месяцев назад

    This video should have more views 👍

  • @jafeta.7553
    @jafeta.7553 Месяц назад

    Great video. Thank you very much!

  • @luisgarciacuesta6120
    @luisgarciacuesta6120 11 месяцев назад +1

    Great video, thanks!

  • @Optimusjf
    @Optimusjf Месяц назад

    Excelent

  • @user-wq2mi9bm3n
    @user-wq2mi9bm3n 2 месяца назад

    Отличное видео

  • @Smarandii
    @Smarandii 6 месяцев назад

    Good job comrade

  • @radoniainarakotonirina2856
    @radoniainarakotonirina2856 8 месяцев назад

    Very interesting

  • @user-bd7pi5jv4z
    @user-bd7pi5jv4z Месяц назад

    can you send a book you are referring to in your video?

  • @akshaysarbhukan6701
    @akshaysarbhukan6701 Год назад +1

    Thanks for the tutorial. I have a question, is there any way to implement server sent events in FastAPI?

    • @evgenymaksimov
      @evgenymaksimov  Год назад

      take a look at pip package sse-starlette, it adds this functionality and you can use it with fastapi!

    • @akshaysarbhukan6701
      @akshaysarbhukan6701 Год назад

      @@evgenymaksimov thanks. So basically FastAPI still uses http 1.1 on top of which sse-starlette implements SSE, am I correct?

    • @evgenymaksimov
      @evgenymaksimov  Год назад +1

      @@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 Год назад

      @@evgenymaksimov yeah, got it. Thanks again for the help.

  • @jimmykhaidem9291
    @jimmykhaidem9291 7 месяцев назад

    Hi bro, can you make a video of using chunk method

  • @tomasemilio
    @tomasemilio 4 месяца назад

    Awesome

  • @alekseichulei9955
    @alekseichulei9955 8 месяцев назад

    Did you try to use psycopg3 since it provides async?

  • @chapizishorts6528
    @chapizishorts6528 7 месяцев назад

    14:50 What about GIL, doesn't it forbid to create multiple threads within 1 process?

    • @evgenymaksimov
      @evgenymaksimov  7 месяцев назад

      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

  • @unicoxr5tj417
    @unicoxr5tj417 Год назад +1

    подписался) Жека а че не на русском?)