Comments (7)
@kezhenxu94
感谢解答,我有将skyapm-nodejs里的grpc更改为@grpc/grpc-js版本,压测发现内存不再激增,但我放到服务器上后,运行一周后,内存依旧会增高到1G左右,在不添加skyapm-nodejs包后,我的内存基本维持在100M。
from skyapm-nodejs.
@iliuyt 我这边使用你的 demo 代码无法复现, 加大 qps 也无法复现
from skyapm-nodejs.
以下是我的环境
es集群
version: "2.0"
services:
elasticsearch-central:
image: elasticsearch:6.5.0
container_name: es1
volumes:
- ./node/es1/data:/usr/share/elasticsearch/data
- ./node/es1/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- ES_CLUSTERNAME=elasticsearch
command: elasticsearch
ports:
- "9200:9200"
- "9300:9300"
networks:
default:
ipv4_address: 172.21.0.100
elasticsearch-data:
image: elasticsearch:6.5.0
container_name: es2
volumes:
- ./node/es2/data:/usr/share/elasticsearch/data
- ./node/es2/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- ES_CLUSTERNAME=elasticsearch
command: elasticsearch
ports:
- "9201:9200"
- "9301:9300"
links:
- elasticsearch-central:elasticsearch
networks:
default:
ipv4_address: 172.21.0.101
elasticsearch-head:
image: mobz/elasticsearch-head:5
container_name: head
volumes:
- ./head/Gruntfile.js:/usr/src/app/Gruntfile.js
- ./head/_site/app.js:/usr/src/app/_site/app.js
ports:
- "9100:9100"
links:
- elasticsearch-central:elasticsearch
networks:
default:
ipv4_address: 172.21.0.102
networks:
default:
external:
name: common
skywalking
version: '3.3'
services:
oap:
image: apache/skywalking-oap-server:7.0.0-es6
container_name: oap
restart: always
ports:
- 11800:11800
- 12800:12800
environment:
- SW_STORAGE=elasticsearch #Es的存储
- SW_STORAGE_ES_CLUSTER_NODES=172.21.0.100:9200
- TZ=Asia/Shanghai
networks:
default:
ipv4_address: 172.21.0.201
ui:
image: apache/skywalking-ui:7.0.0
container_name: ui
depends_on:
- oap
links:
- oap
restart: always
ports:
- 18080:8080 #默认8080端口,这里设置18080映射到宿主机,可修改
environment:
collector.ribbon.listOfServers: 172.21.0.201:12800
networks:
default:
ipv4_address: 172.21.0.202
networks:
default:
external:
name: common
其他信息
- nodejs v10.16.3
- macos 10.15.2
- skyapm-ndoejs 1.2.0
- npm 源为https://registry.npmjs.org/
from skyapm-nodejs.
另外阅读源码中有一些诱惑,能否帮忙解答
源码中 lib/cache/index.js中
1、put方法里的判断是什么意思?
2、scheduleConsumeData方法中为什么调用了this._timeout.unref();?
具体看我下面代码的注释
TraceSegmentCachePool.prototype.put = function(traceSegment) {
this._bucket.push(traceSegment);
// this._bucketSize是一个bool类型,这里和-1对比永远都是true
// 第二个判断也没理解什么意思,为什么要用长度和bool对比
if (this._bucketSize !== -1 && this._bucket.length >= this._bucketSize) {
this.consumeData();
} else if (!this._timeout) {
this.scheduleConsumeData();
}
};
TraceSegmentCachePool.prototype.scheduleConsumeData = function() {
let self = this;
this._timeout = setTimeout(function() {
self.consumeData();
}, this._flushInterval);
// 这里调用unref就取消了发送请求,为什么要调用unref呢
this._timeout.unref();
};
from skyapm-nodejs.
@iliuyt 多谢提供环境详情, 我晚上试试看
- 那个判断是个 bug, 已经修复了
- 我的理解是
unref
并不会取消发送, 只是让这个timer
不会阻止 Node 进程退出, 类似 Java 中设置线程为 Daemon
from skyapm-nodejs.
建议检查后端是否有足够的处理能力。同时,需要检查
- grpc组件是不是在进行streaming处理时,等待的服务端处理的结束信号才再次发送(onComplete信号)
- buffer是否具有过载抛弃机制。
这是java agent在面临上述场景时的典型保护设计。
from skyapm-nodejs.
我看到bug最近已修复,#111
from skyapm-nodejs.
Related Issues (20)
- When will 2.0.0 be released to support sw8? HOT 1
- encounter an error when packing
- Version 2.0.0 HOT 4
- SIGTERM HOT 2
- Whether skyWalking8.0 is supported on skyapm-nodejs HOT 7
- How to customize traceid generation rules? HOT 8
- Node JS12 is supported by Skywalking 7.0.0 HOT 4
- ContextCarrier.prototype.serialize should encode _parentService and _parentServiceInstance HOT 2
- egg服务在压测之后,无法生成新的trace日志
- Nodejs agent segment not finish when high level QPS HOT 4
- WrapEmit unable to handle error correctly
- mysql createPoolCluster will generate new tracerId
- await will generate new tracerId
- add support rabbitmq? HOT 1
- Typescript support ?
- Segmentation fault HOT 1
- support SSL?
- Close agent when server returns PERMISSION_DENIED HOT 3
- egg,egg-core模块无法追踪 HOT 1
- nuxt项目中应该如何使用? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skyapm-nodejs.