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

⚗ performance impact summary tool #755

Merged
merged 18 commits into from
Mar 8, 2021
Merged

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Mar 3, 2021

Motivation

Evaluate the Browser SDK performance impact on a given scenario

Changes

Implement a tool to run various profilings with puppeteer. You can try it with:

Testing

git checkout benoit/performance-doc
yarn
cd performances
yarn start

Example output:

# Wikipedia

Illustrates a mostly static site scenario.

* Navigate on three Wikipedia articles
* Do a search (with dynamic autocompletion) and go the first result

Memory (median): 294 kB (4.83%)
CPU: 258 ms (4.24%)
Bandwidth:
  upload: 116 kB
  download: 20.5 kB


# Twitter

Illustrates a SPA scenario.

* Navigate to the top trending topics
* Click on the first trending topic
* Click on Top, Latest, People, Photos and Videos tabs
* Navigate to the Settings page
* Click on a few checkboxes

Memory (median): 225 kB (0.51%)
CPU: 391 ms (1.01%)
Bandwidth:
  upload: 186 kB
  download: 20.5 kB

From my observations, results are quite stable in general.


I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review March 5, 2021 09:24
@BenoitZugmeyer BenoitZugmeyer requested review from a team as code owners March 5, 2021 09:24
@BenoitZugmeyer BenoitZugmeyer changed the title ⚗ POC: performance impact summary tool ⚗ performance impact summary tool Mar 5, 2021
@ThibautGeriz
Copy link
Contributor

Regarding the stat I would add more than the median like 95 and 99 percentile.
The CPU is not super clear:

CPU: 146,665 microseconds (6.455%)

Is it microsecond per something? seconds? session?

It would be super cool to add this to graph that to see the evolution in time.

@BenoitZugmeyer
Copy link
Member Author

Regarding the stat I would add more than the median like 95 and 99 percentile.

Maybe p75 would make sense, but 95 or 99 would just show the max value, because we don't take that many measurements.

The CPU is not super clear:

CPU: 146,665 microseconds (6.455%)

Is it microsecond per something? seconds? session?

It is plain microseconds. How much CPU time Browser SDK-located code has taken during the scenario.

It would be super cool to add this to graph that to see the evolution in time.

Would be cool indeed :)

await page.goto('https://en.wikipedia.org/wiki/Event_monitoring')
await takeMeasurements()
await page.goto('https://en.wikipedia.org/wiki/Datadog')
await takeMeasurements()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it would be statistically better to run takeMeasurements periodically (like every 100 ms or so) instead of triggering it manually during the scenario. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would matter too much. I like controling when to take measurements, when the page is idle after doing something. If we didn't:

  • measurements could be taken while the page is loading, when the SDK is not yet loaded, yielding not applicable results for our use-case
  • measurements could be taken while some JS is running, and may impact the CPU profiling.

@ThibautGeriz
Copy link
Contributor

It is plain microseconds. How much CPU time Browser SDK-located code has taken during the scenario.

Cool then I would add the time it took to run the scenario as 146,665 microseconds or upload: 162,482 bytes is not the same if the scenario lasted 1h ou 2.5 seconds.

performances/README.md Outdated Show resolved Hide resolved
@BenoitZugmeyer
Copy link
Member Author

It is plain microseconds. How much CPU time Browser SDK-located code has taken during the scenario.

Cool then I would add the time it took to run the scenario as 146,665 microseconds or upload: 162,482 bytes is not the same if the scenario lasted 1h ou 2.5 seconds.

Well, it could be the same if the scenario lasts 1h or 2.5 seconds. The impact is not proportional to the scenario duration, but more on which actions are being done during it (ex: number of new views, resources loaded, etc.) The scenario duration would not be indicative of real world SDK usage, because no human will read 5 Wikipedia articles in 2 seconds :)

Copy link
Contributor

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@webNeat webNeat self-requested a review March 8, 2021 10:19
Copy link
Contributor

@webNeat webNeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/performance-doc branch from f455fe3 to 1ecedcd Compare March 8, 2021 16:03
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.

5 participants