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

feat(core): add Node.js memory perf logging #10590

Merged
merged 6 commits into from
Oct 17, 2024
Merged

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Oct 17, 2024

Motivation

This enhance the DOCUSAURUS_PERF_LOGGER=true env variable described in #4765 (comment)

Although we consider it an internal API, users can still use this env variable to troubleshoot performance and memory usage of their Docusaurus site.

Note: it's better to run this with the --expose-gc Node.js option, so that heap memory consumption gets measured just after triggering a manual GC.

export DOCUSAURUS_PERF_LOGGER=true
export NODE_OPTIONS="--max-old-space-size=300 --expose-gc"

yarn build

Our infrastructure should make it easy to figure out which step consumes Node.js heap memory:

CleanShot 2024-10-17 at 18 38 40@2x

For now, it only logs before/after memory, but we could enhance this later with sampling and add an average memory consumption for each recorded step.

Note I'd also like to wire all this to our CI in the future so that PRs can report memory usage regressions, similar to what Astro is doing here:

Test Plan

local

Links

Related to #4765

Follow-up of #9975

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 17, 2024
@slorber slorber added pr: new feature This PR adds a new API or behavior. and removed CLA Signed Signed Facebook CLA labels Oct 17, 2024
Copy link

netlify bot commented Oct 17, 2024

[V2]

Name Link
🔨 Latest commit 1ad99f7
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/67115f5cc884660008a74ce8
😎 Deploy Preview https://deploy-preview-10590--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Oct 17, 2024

Size Change: +349 B (0%)

Total Size: 11.2 MB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/codeTranslations.json 2 B 0 B
website/.docusaurus/docusaurus.config.mjs 28 kB 0 B
website/.docusaurus/globalData.json 30.4 kB 0 B
website/.docusaurus/i18n.json 930 B 0 B
website/.docusaurus/registry.js 155 kB 0 B
website/.docusaurus/routes.js 74.6 kB 0 B
website/.docusaurus/routesChunkNames.json 81.8 kB 0 B
website/.docusaurus/site-metadata.json 2.17 kB 0 B
website/build/assets/css/styles.********.css 120 kB 0 B
website/build/assets/js/main.********.js 729 kB 0 B
website/build/assets/js/runtime~main.********.js 35.8 kB 0 B
website/build/blog.html 58.1 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus.html 72.2 kB 0 B
website/build/blog/2018/04/30/How-I-Converted-Profilo-To-Docusaurus.html 45.1 kB +12 B (+0.03%)
website/build/blog/2018/09/11/Towards-Docusaurus-2.html 49.4 kB 0 B
website/build/blog/2018/12/14/Happy-First-Birthday-Slash.html 28.6 kB 0 B
website/build/blog/2019/12/30/docusaurus-2019-recap.html 37.5 kB -1 B (0%)
website/build/blog/2020/01/07/tribute-to-endi.html 32.1 kB 0 B
website/build/blog/2021/01/19/docusaurus-2020-recap.html 46.5 kB 0 B
website/build/blog/2021/03/09/releasing-docusaurus-i18n.html 42.9 kB -1 B (0%)
website/build/blog/2021/05/12/announcing-docusaurus-two-beta.html 45.2 kB 0 B
website/build/blog/2021/11/21/algolia-docsearch-migration.html 50.3 kB +12 B (+0.02%)
website/build/blog/2022/01/24/docusaurus-2021-recap.html 42.4 kB 0 B
website/build/blog/2022/08/01/announcing-docusaurus-2.0.html 134 kB 0 B
website/build/blog/2022/09/01/docusaurus-2.1.html 48.2 kB -1 B (0%)
website/build/blog/archive.html 23.1 kB 0 B
website/build/blog/authors.html 43.9 kB 0 B
website/build/blog/authors/j-marcey.html 61.9 kB 0 B
website/build/blog/authors/josh-cena.html 40.7 kB 0 B
website/build/blog/authors/lex-111.html 47.6 kB 0 B
website/build/blog/authors/slorber.html 58 kB 0 B
website/build/blog/authors/slorber/authors/2.html 61.8 kB 0 B
website/build/blog/authors/slorber/authors/3.html 73.6 kB 0 B
website/build/blog/authors/slorber/authors/4.html 42.1 kB 0 B
website/build/blog/authors/yangshun.html 54.8 kB 0 B
website/build/blog/authors/zpao.html 41.1 kB 0 B
website/build/blog/page/2.html 62.6 kB 0 B
website/build/blog/page/3.html 68.3 kB 0 B
website/build/blog/page/4.html 61.1 kB 0 B
website/build/blog/page/5.html 39.8 kB 0 B
website/build/blog/preparing-your-site-for-docusaurus-v3.html 132 kB +4 B (0%)
website/build/blog/releases/2.2.html 47.1 kB 0 B
website/build/blog/releases/2.3.html 57.9 kB 0 B
website/build/blog/releases/2.4.html 62.1 kB 0 B
website/build/blog/releases/3.0.html 107 kB +12 B (+0.01%)
website/build/blog/releases/3.1.html 49.5 kB +1 B (0%)
website/build/blog/releases/3.2.html 46.3 kB 0 B
website/build/blog/releases/3.3.html 52.9 kB 0 B
website/build/blog/releases/3.4.html 53.1 kB +7 B (+0.01%)
website/build/blog/releases/3.5.html 55.3 kB +1 B (0%)
website/build/blog/tags.html 26.7 kB 0 B
website/build/blog/upgrading-frontend-dependencies-with-confidence-using-visual-regression-testing.html 123 kB 0 B
website/build/docs.html 47 kB 0 B
website/build/docs/advanced.html 29.4 kB 0 B
website/build/docs/advanced/architecture.html 28.9 kB +4 B (+0.01%)
website/build/docs/advanced/client.html 72.7 kB 0 B
website/build/docs/advanced/plugins.html 56 kB 0 B
website/build/docs/advanced/routing.html 70.8 kB +8 B (+0.01%)
website/build/docs/advanced/ssg.html 77.8 kB 0 B
website/build/docs/api/docusaurus-config.html 194 kB 0 B
website/build/docs/api/misc/@docusaurus/eslint-plugin.html 45.7 kB +4 B (+0.01%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-html-links.html 36 kB 0 B
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-untranslated-text.html 34.9 kB 0 B
website/build/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading.html 36.2 kB +4 B (+0.01%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages.html 39.8 kB 0 B
website/build/docs/api/misc/@docusaurus/logger.html 37.9 kB 0 B
website/build/docs/api/misc/create-docusaurus.html 33 kB 0 B
website/build/docs/api/plugin-methods.html 64.6 kB +4 B (+0.01%)
website/build/docs/api/plugin-methods/extend-infrastructure.html 60.2 kB +4 B (+0.01%)
website/build/docs/api/plugin-methods/i18n-lifecycles.html 58.1 kB +4 B (+0.01%)
website/build/docs/api/plugin-methods/lifecycle-apis.html 164 kB 0 B
website/build/docs/api/plugin-methods/static-methods.html 44.4 kB +4 B (+0.01%)
website/build/docs/api/plugins.html 30.1 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-client-redirects.html 59.7 kB +13 B (+0.02%)
website/build/docs/api/plugins/@docusaurus/plugin-content-blog.html 189 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-content-docs.html 194 kB +9 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-content-pages.html 74.2 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-debug.html 48.2 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-google-analytics.html 49.1 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-google-gtag.html 48.6 kB -4 B (-0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-google-tag-manager.html 47.5 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-ideal-image.html 48.6 kB +4 B (+0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-pwa.html 116 kB +4 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-rsdoctor.html 39.8 kB 0 B
website/build/docs/api/plugins/@docusaurus/plugin-sitemap.html 65.5 kB +6 B (+0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-vercel-analytics.html 40.1 kB +12 B (+0.03%)
website/build/docs/api/themes.html 28.7 kB 0 B
website/build/docs/api/themes/@docusaurus/theme-classic.html 44 kB +4 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-live-codeblock.html 36.6 kB +4 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-mermaid.html 35.5 kB +4 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-search-algolia.html 32.8 kB 0 B
website/build/docs/api/themes/configuration.html 243 kB 0 B
website/build/docs/blog.html 211 kB +6 B (0%)
website/build/docs/browser-support.html 48.4 kB 0 B
website/build/docs/category/getting-started.html 26.6 kB 0 B
website/build/docs/category/guides.html 34.5 kB 0 B
website/build/docs/cli.html 59.9 kB +1 B (0%)
website/build/docs/configuration.html 98.7 kB +8 B (+0.01%)
website/build/docs/create-doc.html 62.3 kB +12 B (+0.02%)
website/build/docs/creating-pages.html 56.4 kB +1 B (0%)
website/build/docs/deployment.html 203 kB +8 B (0%)
website/build/docs/docs-introduction.html 50.9 kB 0 B
website/build/docs/docs-multi-instance.html 75 kB +4 B (+0.01%)
website/build/docs/docusaurus-core.html 236 kB 0 B
website/build/docs/guides/whats-next.html 30.9 kB 0 B
website/build/docs/i18n/crowdin.html 145 kB +12 B (+0.01%)
website/build/docs/i18n/git.html 78.8 kB +4 B (+0.01%)
website/build/docs/i18n/introduction.html 48.3 kB 0 B
website/build/docs/i18n/tutorial.html 164 kB +13 B (+0.01%)
website/build/docs/installation.html 70.7 kB +5 B (+0.01%)
website/build/docs/introduction/index.html 280 B 0 B
website/build/docs/markdown-features.html 79.9 kB +1 B (0%)
website/build/docs/markdown-features/admonitions.html 113 kB +4 B (0%)
website/build/docs/markdown-features/assets.html 89.2 kB +2 B (0%)
website/build/docs/markdown-features/code-blocks.html 235 kB +4 B (0%)
website/build/docs/markdown-features/diagrams.html 53.1 kB +14 B (+0.03%)
website/build/docs/markdown-features/head-metadata.html 50.1 kB 0 B
website/build/docs/markdown-features/links.html 40.8 kB 0 B
website/build/docs/markdown-features/math-equations.html 90.5 kB +11 B (+0.01%)
website/build/docs/markdown-features/plugins.html 96.6 kB +8 B (+0.01%)
website/build/docs/markdown-features/react.html 138 kB +5 B (0%)
website/build/docs/markdown-features/tabs.html 142 kB 0 B
website/build/docs/markdown-features/toc.html 84.8 kB +4 B (0%)
website/build/docs/migration.html 40.7 kB +4 B (+0.01%)
website/build/docs/migration/v2.html 39.1 kB 0 B
website/build/docs/migration/v2/automated.html 40.4 kB 0 B
website/build/docs/migration/v2/manual.html 198 kB 0 B
website/build/docs/migration/v2/translated-sites.html 50.3 kB 0 B
website/build/docs/migration/v2/versioned-sites.html 64.2 kB 0 B
website/build/docs/migration/v3.html 209 kB +1 B (0%)
website/build/docs/playground.html 30.7 kB 0 B
website/build/docs/resources/index.html 325 B 0 B
website/build/docs/search.html 116 kB +1 B (0%)
website/build/docs/seo.html 88.7 kB +13 B (+0.01%)
website/build/docs/sidebar.html 130 kB +4 B (0%)
website/build/docs/sidebar/autogenerated.html 150 kB +13 B (+0.01%)
website/build/docs/sidebar/items.html 180 kB 0 B
website/build/docs/sidebar/multiple-sidebars.html 63.7 kB +4 B (+0.01%)
website/build/docs/static-assets.html 53.4 kB +4 B (+0.01%)
website/build/docs/styling-layout.html 135 kB 0 B
website/build/docs/support/index.html 319 B 0 B
website/build/docs/swizzling.html 115 kB +14 B (+0.01%)
website/build/docs/team/index.html 310 B 0 B
website/build/docs/typescript-support.html 62.3 kB 0 B
website/build/docs/using-plugins.html 110 kB +13 B (+0.01%)
website/build/docs/versioning.html 83.1 kB +13 B (+0.02%)
website/build/index.html 35.8 kB 0 B

compressed-size-action

Copy link

github-actions bot commented Oct 17, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🔴 46 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 51 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 73 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 62 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 47 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 65 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 74 🟢 100 🟢 100 🟠 86 Report

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 17, 2024
@slorber slorber merged commit 762f7b1 into main Oct 17, 2024
36 checks passed
@slorber slorber deleted the slorber/perf-log-memory branch October 17, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants