https://github.com/naugtur/node-example-flamegraph
https://github.com/naugtur/node-example-flamegraph
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/naugtur/node-example-flamegraph
- Owner: naugtur
- License: mit
- Created: 2017-05-19T14:38:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-17T21:38:18.000Z (about 8 years ago)
- Last Synced: 2025-03-17T14:49:03.316Z (7 months ago)
- Language: Shell
- Size: 138 KB
- Stars: 67
- Watchers: 2
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flame graph exercise
## Preparation
run `npm install` in here
Don't analyze `app.js` before trying the task## Difficulty
Open app.js and modify `HOW_OBVIOUS_THE_FLAME_GRAPH_SHOULD_BE_ON_SCALE_1_TO_100`
It will affect how hard it is to find the function you're looking for.difficulty level | value
--- | ---
a month old baby would spot it | 100
still easy | 30
normal | 10 (default)
hard | 5
please try normal first ;) | 1## Task 1
Run the app through perf. Make the following request:
```
curl http://localhost:8080/api/tick
```
Or just open it in the browser.Generate a flame graph, identify the function in your code that performs the long synchronous computation.
## Task 2
Now for something more realistic.Start the app, open http://localhost:8080/ to simulate traffic (it repeatedly makes requests to /api/tick), run a short perf on the running process and generate a flame graph. See if you would identify the function under real traffic. Try with shorter sleep and lower profiling frequency too.