Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executable Tutorial Final Submission (jmatsso-oschel) #2651

Merged
merged 7 commits into from
Oct 16, 2024
Merged

Conversation

Smissen
Copy link
Contributor

@Smissen Smissen commented Oct 14, 2024

Assignment Proposal

Title

Profiling Python Applications Without Modifying Code With Py-Spy

Names and KTH ID

Deadline

  • Task 3

Category

  • Executable tutorial

Description

We will be using this tutorial to show how to use py-spy, a python sampling profiler, to quickly improve performance. The tool tracks how much time is spent executing various parts of the program which helps the developer narrow down problematic areas of code faster. It can be attached to running python process, without code change or restarts required. All with a low overhead that makes it suitable to be used even in production

Relevance

The flexibility and automation of the tool makes it suitable in fast moving environments where it helps developers save time performance tuning, reducing time from coding to user. It can then be used in production to monitor performance so elusive bugs can be stopped easier. Identifying bottlenecks is not always easy in production code and using tools such as py-spy that can help with profiling and tracing makes it much easier for developers to do their job, therefore it is om importance to DevOps.

The insights gained from local profiling with py-spy can directly inform what to monitor in production. For example, if local profiling highlights specific functions or parts of the code that are resource-intensive, these areas can become key monitoring metrics in production
Py-spy works well in production environments, where it can be attached to running Python applications without restarting or modifying the code. This non-intrusive capability is critical in production monitoring, as downtime or code changes are often not acceptable.
Some other features except that it can attach to running processes is that it has low overhead and also can produce flame-graphs for visualisation. Also py-spy can be used both for pre-deployment testing and post-deployment monitoring for example in canary or blue-green deployments

Killercoda: https://killercoda.com/smissen/scenario/py-spy101
Github: https://github.com/Smissen/py-spy-executable-tutorial

@Flug0
Copy link
Contributor

Flug0 commented Oct 14, 2024

Assignment Proposal

Title

Feedback for executable tutorial "Profiling Python Applications Without Modifying Code With Py-Spy".

Names and KTH ID

Deadline

Task 3

Category

Feedback

Description

We would like to give you guys some feedback! :)

@phlagooo
Copy link

Sure, go ahead Flug0

@javierron javierron merged commit 2b70038 into KTH:2024 Oct 16, 2024
1 check passed
@Flug0
Copy link
Contributor

Flug0 commented Oct 17, 2024

Feedback

by Oscols & Hugomal

I/We certify that generative AI, incl. ChatGPT, has not been used to write this feedback. Using generative AI without permission is considered academic misconduct.

High-level Strengths

Clear Introduction

The introduction to your tutorial was clear with great explanations of the intended learning outcomes and why the tutorial is relevant to DevOps. The overview at the end of the introduction improved the clarity of the introduction too.

Easy to follow

The tutorial was overall very easy to follow and understand, there was never any confusion, and it was always very clear on when the user had to do something. The inclusion of screenshots helped make it very easy to understand.

Bogosort

It was very nice to see bogosort make its way into this tutorial. It is sad to see how the computer scientist community refuses to acknowledge the superior algorithms like bogosort, as it quite clearly has the potential to be the fastest sorting algorithm sometimes.

High-level Weaknesses

Verify steps

The tutorial did not use any sort of verification to make sure that the user was on the right path and had not forgotten any step or made an error. This is quite easy to add in KillerKoda. See an example from KillerKoda on verification, and it may help prevent frustrated users that might make minor errors or mistakes.

Details

Introduction

Clear and concise explanation of what the intended learning outcomes of the tutorial are. In the intended learning outcomes, you also give a great introduction to Py-Spy, which is very helpful if the user does not already know what it is.

It is also convenient that you include the prerequisites for the tutorial, so the user knows if this tutorial could be worthwhile for them or if they will most likely waste their time due to lack of understanding of what’s actually happening. However, there might be a typo in this section.

You are also motivating your tutorial well. It becomes clear from your reasoning why it is important to DevOps. In the motivation, you also include some good background information on Py-Spy.

We noticed that you did not include any informative figures, such as flowcharts, but you did, however, include an overview of the tutorial, which was nice. The overview gave a good impression of what to expect at each stage. In case you would want to include a flowchart, we would recommend using Lucidchart, it was easy to use and you did not have to pay to create a simple chart.

Installation

The installation instructions are very clear and easy to follow. It was also nice to see that you included how to install it on Mac as well, and not just on Linux-based systems. It was, however, a bit confusing as to why you did not include the installation and verification that it was done correctly for the terminal viewer installation on the same page as the installation of Py-Spy. It does make sense why you put it there, as it is only relevant to that part of the tutorial, but it is common practice to include all installations and verify that everything is installed correctly before the tutorial starts.

Py-Spy Commands

The commands you chose to include in the tutorial were top, dump, and record. All instructions on how to use these were clearly written and explained. You included screenshots, which made it even easier to follow along and be sure that you were on the right track.

Exercise

The exercise was a very good and fun way to show the user how they can use Py-Spy as a tool in their workflow. It was easy to follow, and the addition of humor made it very engaging. It would probably have been good to include some more of the commands, like dump or record, but the exercise was still great at showing how Py-Spy can be used.

Easter Egg

We figured that both the inclusion of bogosort and Snorlax were two Easter eggs, and though they were not difficult to discover, they were very humorous additions!

@Flug0 Flug0 mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants