node heapdump

写一个node服务

const Koa = require('koa')
const app = new Koa()
class SetMap extends Map {
    
     }
const myMap = new SetMap()
let id = 0
app.use(async (ctx, next) => {
    
    
  ctx.id = id++
  myMap.set(id, ctx)
  await next()
});
app.use(async ctx => {
    
    
  console.log(ctx.id)
  ctx.body = 'Hello World' + ctx.id;
});
app.listen(3004);

安装Apache的ab

ab:下载windows版
解压后复制bin目录到环境变量path

打开 chrome://inspect/#devices 配置地址

在这里插入图片描述

运行 node --inspect app.js 启动服务

运行 ab -n 1000 -c 10 http://127.0.0.1:3004/压一下接口

点开 Open dedicated DevTools for Node 拍摄快照

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42975676/article/details/128703761