peaksnail / pinpoint-node-agent

pinpoint agent for nodejs
Apache License 2.0
75 stars 26 forks source link

trace.manager.enable #17

Closed jiaojiaojiao closed 7 years ago

jiaojiaojiao commented 7 years ago

hi. 看到文档中有这样一句话 “about 7% when trace.manager.enable is true and 30% when trace.manager.enable is false” 想知道你们是怎么测出来,而且我这边开启子进程就报错“return false when send data to child process”

peaksnail commented 7 years ago

hi,7%和30%这两个数据是 根据内部项目压测后前后tps的变化得出来的(与没有使用node-agent得出的数据进行对比)。实际上根据不同项目可能会得出不同的性能损耗率。对于这个被测试的项目,我们也用来测试过oneapm node agent,性能损耗有16%左右。所以如果要得出自己项目真正的性能损耗率,可以自己进行压测对比

对于 子进程返回false,是因为 子进程消息堆积处理不过来返回的状态,我这边测试发现这个信息并没有影响实际的采集和运行

peaksnail commented 7 years ago

目前我们线上环境 也没有开启子进程(trace.manager.enable=false),通过设置较低的采样率来保证 正常的运行,所以需要根据自己的具体情况来决定

jiaojiaojiao commented 7 years ago

我这边开启的话,貌似数据就没有采集到

jiaojiaojiao commented 7 years ago

我这边调试ret一直返回false

 if (TRACE_MANAGER_ENABLE) {
            try {
                var ret = PinpointNodejsAgent.traceManager.send(traceContext.spanRecorder.span);
                if (!ret) {//开启子进程ret一直为false
                    logger.debug('return false when send data to child process');
                }
            } catch(err) {
                logger.error('send trace data to child process failed: ' + err); 
            }
        } else {
            traceContext.dataSend(); 
        }
peaksnail commented 7 years ago

确认下 trace_manager.js 子进程是否存在?如果子进程挂了,也会返回false

2016-12-20 16:45 GMT+08:00 jiaojiaojiao notifications@github.com:

我这边调试ret一直返回false

if (TRACE_MANAGER_ENABLE) { try { var ret = PinpointNodejsAgent.traceManager.send(traceContext.spanRecorder.span); if (!ret) {//开启子进程ret一直为false logger.debug('return false when send data to child process'); } } catch(err) { logger.error('send trace data to child process failed: ' + err); } } else { traceContext.dataSend(); }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/peaksnail/pinpoint-node-agent/issues/17#issuecomment-268187148, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqe39_KZJl9wQLwwT1e8vl4MRzHm1zcks5rJ5WTgaJpZM4LRbDm .

jiaojiaojiao commented 7 years ago

image image 看起来应该是没有 close吧

peaksnail commented 7 years ago

我这边测试是ok的,即使返回false 。。。 1 确认下采集率,如果不是100%的话,可能得请求多次才有数据 2 在 pinpoint-node-agent/agent/commons/trace/trace_manager.js 子进程接收到消息会打印出 "receive new data, start handle it" 。 INFO级别的log,查看下info.log 确认下子进程是否接收到消息 3 再确认下error级别log是否有出错提示? 4 如果 1,2,3 都没问题,说明agent是正常在采集和发送消息的,确认下 collector 是否运行正常?

2016-12-20 17:25 GMT+08:00 jiaojiaojiao notifications@github.com:

[image: image] https://cloud.githubusercontent.com/assets/16285633/21344895/07798d46-c6d9-11e6-8da0-0161898611ea.png [image: image] https://cloud.githubusercontent.com/assets/16285633/21344910/1693f8c0-c6d9-11e6-822d-7a234d735d7f.png 看起来应该是没有 close吧

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/peaksnail/pinpoint-node-agent/issues/17#issuecomment-268194961, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqe34YdgT81WUslAyCZaHCoiDHXj-SLks5rJ572gaJpZM4LRbDm .

jiaojiaojiao commented 7 years ago

根本就没走到那一步,在把数据send 到child process中的时候就有问题

peaksnail commented 7 years ago

info.log 中 确认没有 "receive new data, start handle it"? 那说明发送子进程和父进程之间的通信有问题,能否给下node 版本,这边在确认下?

2016-12-20 18:34 GMT+08:00 jiaojiaojiao notifications@github.com:

根本就没走到那一步,在把数据send 到child process中的时候就有问题

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/peaksnail/pinpoint-node-agent/issues/17#issuecomment-268209914, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqe3_iJNPuETunXMBXqddNcUwCdINF2ks5rJ68zgaJpZM4LRbDm .

jiaojiaojiao commented 7 years ago

node版本是v4.2.6

peaksnail commented 7 years ago

很奇怪,我这边运行正常,你看能否直接在node shell中直接调试,获取到子进程的句柄。来进一步debug?

1 cd pinpoint-node-agent 执行 node 进入node shell node> require('./index.js')

2 node> global.PinpointNodejsAgent.traceManager 此变量为子进程句柄,

拿到子进程句柄再进一步debug,比如 执行 global.PinpointNodejsAgent.traceManager.send 尝试发送一条消息看下返回结果和子进程状态?

2016-12-21 9:23 GMT+08:00 jiaojiaojiao notifications@github.com:

node版本是v4.2.6

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/peaksnail/pinpoint-node-agent/issues/17#issuecomment-268408183, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqe32NAZlcdfElceqjpeKV5c6MK9C7Sks5rKH-hgaJpZM4LRbDm .

jiaojiaojiao commented 7 years ago

嗯嗯,我这边执行 global.PinpointNodejsAgent.traceManager.send一直返回false

peaksnail commented 7 years ago

确认是 false,不是undefined?debug调用send,如果子进程也没有任何输出? 那怀疑子进程可能有问题

jiaojiaojiao commented 7 years ago

是undefined,我试了下不同版本的node我现在4.2.6的一直返回undefined,node版本为6.2.1的,返回true,所以node版本还是有影响的吗

peaksnail commented 7 years ago

之前一直使用的是node 4.x 的版本测试,所以高版本node这边并没有测试过,目前我们生产环境也是4.2.6,实际上运行正常

jiaojiaojiao commented 7 years ago

还有的问题,想要咨询哈,不知道你们在压测的时候,有没有测内存和io相关性能问题,我这边在使用了模块存在内存泄漏的问题

peaksnail commented 7 years ago

压测的时候有相关的监控数据,显示系统的内存和io使用稳定,并没有异常。dump 下进程的内存情况,查看下哪里出问题了?

jiaojiaojiao commented 7 years ago

嗯嗯,经验证是框架问题