py-spy saved our python 3.11 rollout (intermediate) anthony explains

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 มิ.ย. 2024
  • today I show how I solved a perplexing performance degradation using a sampling profiler: py-spy!
    playlist: • anthony explains
    ==========
    twitch: / anthonywritescode
    dicsord: / discord
    twitter: / codewithanthony
    github: github.com/asottile
    stream github: github.com/anthonywritescode
    I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 33

  • @spyr0th3dr4g0n
    @spyr0th3dr4g0n 5 หลายเดือนก่อน +22

    Performance story time and a new to me tool, 10/10 video

  • @kRySt4LGaMeR
    @kRySt4LGaMeR 5 หลายเดือนก่อน +2

    Every once and a while youtube starts suggesting me your videos and it's always a joy to learn more.

  • @TigerWalts
    @TigerWalts 5 หลายเดือนก่อน +4

    Sampling profilers are also useful for languages that use exceptions as some trace profilers can lose track and end up with either incorrect trees or tree nodes bundling the gap with a name that may as well be ¯\_(ツ)_/¯. I've also seen trace profilers just hang or return zero data as well as nodes in completely the wrong place.
    Not capturing all possible call stacks isn't a problem if you are debugging a high CPU problem. A few hundred samples is usually enough.

  • @vinitkumar2923
    @vinitkumar2923 5 หลายเดือนก่อน +1

    Another Gem. Great work and useful tip. :)

  • @user-nv3fy6bd4p
    @user-nv3fy6bd4p 5 หลายเดือนก่อน

    love stuff. always fascinating how strange these bugs manifest in production.

  • @gaiashkenazy
    @gaiashkenazy 4 หลายเดือนก่อน

    Great video!! I learn so much from your videos!!

  • @nevokrien95
    @nevokrien95 5 หลายเดือนก่อน +1

    It's kinda wild to me that I am still using 3.8 for most projects that need the strongest compute.
    Kinda funy how things went the other way with deeplearning and hpc

  • @Hello-od2tj
    @Hello-od2tj 5 หลายเดือนก่อน

    love these kind of videos

  • @sillybuttons925
    @sillybuttons925 5 หลายเดือนก่อน

    I like these solving real world problem vids.

  • @BrianJorgensenAbides
    @BrianJorgensenAbides 5 หลายเดือนก่อน

    I’m not even sure we haven’t worked together, you remind me of my favorite python CS athletes and colleagues.
    But I definitely clicked on this because of your shocked face in the thumbnail. Haha, you don’t do that often. Thanks for being authentic, sir!
    (I heard the tech details too, just had to compliment)

  • @gardnmi
    @gardnmi 5 หลายเดือนก่อน +4

    Interesting, looking at the docs of 3.11 it doesn't say anything changed in inspect.stack except for the return type. Curious that is so much slower.

    • @d3stinYwOw
      @d3stinYwOw 5 หลายเดือนก่อน +2

      Changing return type might be just what's documented 'for the user'. Internally it might change a lot to meet that new return type.

    • @anthonywritescode
      @anthonywritescode  5 หลายเดือนก่อน +7

      if you watch to the end or look closely at the profile it's not actually inspect stack where the self time happens and the slowdown occurs but in getmodule

  • @shreekss2539
    @shreekss2539 5 หลายเดือนก่อน

    Great video. I would love to see a video on Celery.

    • @anthonywritescode
      @anthonywritescode  5 หลายเดือนก่อน +1

      I do not recommend using celery so I probably won't be making a video on it

    • @chiragjn101
      @chiragjn101 5 หลายเดือนก่อน

      @@anthonywritescode I would still like a video on why celery might not be the best choice. I have used celery quite extensively in production and I too would pick something lighter like dramatiq just because of the number of regressions across three or more separate libraries (kombu, billiard, celery) every version upgrade. Can't really blame the already small team of maintainers, it is a huge project that everyone uses differently.

  • @amminamaro
    @amminamaro 4 หลายเดือนก่อน

    Any opinions on 'scalene' Which is another profiler I have heard of but not used. Perhaps it is of this other profile type you mentioned?

    • @anthonywritescode
      @anthonywritescode  4 หลายเดือนก่อน

      haven't used it but it is another sampling profiler

  • @yudhiesh1997
    @yudhiesh1997 4 หลายเดือนก่อน

    What do you think about using a continuous profiler for your applications in Production?

    • @anthonywritescode
      @anthonywritescode  4 หลายเดือนก่อน

      I wouldn't do it all the time. a profiler adds significant overhead and most of the time you don't care about performance data

    • @yudhiesh1997
      @yudhiesh1997 4 หลายเดือนก่อน

      @@anthonywritescode sorry I meant using a sampling profiler continuously. There is still some slight overhead and just with logging you get to see what happens most of the time as it happens.

    • @anthonywritescode
      @anthonywritescode  4 หลายเดือนก่อน +1

      at scale "slight overhead" is significant

  • @RuslanKovtun
    @RuslanKovtun 5 หลายเดือนก่อน

    12:00 - why do you have `Generator[str, None, None]` instead of `Iterable[str]`?

  • @C0pernicus
    @C0pernicus 4 หลายเดือนก่อน

    Any thoughts on this compared to pyinstrument?

  • @robosergTV
    @robosergTV 5 หลายเดือนก่อน +1

    we dont even know what sentry is and what it does. A little bit of context would have been very helpful

    • @anthonywritescode
      @anthonywritescode  5 หลายเดือนก่อน +2

      use your favorite search engine -- though if you're a developer I'm surprised you haven't heard of it