Skip to content

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

@hyj1991

Description

@hyj1991

背景

通过 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 中给出可视化分析结果。

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions