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

[RFC] 启动阶段分析报告 #107

Open
3 tasks
hyj1991 opened this issue Nov 21, 2021 · 0 comments
Open
3 tasks

[RFC] 启动阶段分析报告 #107

hyj1991 opened this issue Nov 21, 2021 · 0 comments
Assignees
Labels

Comments

@hyj1991
Copy link
Member

hyj1991 commented Nov 21, 2021

背景

通过 CPU profile 以可视化分析报告的形式展示 Node.js 进程启动阶段构成,用来处理一些启动阶段的性能问题。

方案

  • 插件支持通过一组配置开启启动阶段分析能力
    • enable_startup_analysis:启用启动前的分析 CPU profiling 的能力
    • 配置 estimated_startup_cost:确认启动阶段预估时间

其中 estimated_startup_cost 也可以在明确启动结束的地方使用 xprofiler.ready() 来替换,例如:

http.createServer(requestHandler).listen(8888, ()=>{
    console.log('server running.');
    xprofiler.ready();
});

结束后 xtransit 会在最近的一次采集中将得到的 CPU Profile 上报给监控服务端(时间戳校验有效性)。

xprofiler-console 会在收到此分析报告后在启动阶段分析的 Tab 中给出可视化分析结果。

@hyj1991 hyj1991 self-assigned this Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant